15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/string16.h" 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/native_widget_types.h" 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace chrome { 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)enum MessageBoxResult { 14c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) MESSAGE_BOX_RESULT_NO = 0, // User chose NO or CANCEL. 15c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) MESSAGE_BOX_RESULT_YES = 1, // User chose YES or OK. 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)enum MessageBoxType { 19f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) MESSAGE_BOX_TYPE_INFORMATION, // Shows an OK button. 20f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) MESSAGE_BOX_TYPE_WARNING, // Shows an OK button. 21f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) MESSAGE_BOX_TYPE_QUESTION, // Shows YES and NO buttons. 22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) MESSAGE_BOX_TYPE_OK_CANCEL, // Shows OK and CANCEL buttons (Aura only). 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Shows a dialog box with the given |title| and |message|. If |parent| is 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// non-NULL, the box will be made modal to the |parent|, except on Mac, where it 27c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// is always app-modal. 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// NOTE: In general, you should avoid this since it's usually poor UI. 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// We have a variety of other surfaces such as wrench menu notifications and 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// infobars; consult the UI leads for a recommendation. 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)MessageBoxResult ShowMessageBox(gfx::NativeWindow parent, 33a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const base::string16& title, 34a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const base::string16& message, 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) MessageBoxType type); 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 37f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Shows a dialog box with the given |title| and |message|, and with two buttons 38f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// labeled with |yes_text| and |no_text|. If |parent| is non-NULL, the box will 39f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// be made modal to the |parent|. (Aura only.) 40f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// 41f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// NOTE: In general, you should avoid this since it's usually poor UI. 42f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// We have a variety of other surfaces such as wrench menu notifications and 43f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// infobars; consult the UI leads for a recommendation. 44f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)MessageBoxResult ShowMessageBoxWithButtonText(gfx::NativeWindow parent, 45a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const base::string16& title, 46a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const base::string16& message, 47a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const base::string16& yes_text, 48a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const base::string16& no_text); 49f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace chrome 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ 53