simple_message_box.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
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)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/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 {
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MESSAGE_BOX_RESULT_NO = 0,
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MESSAGE_BOX_RESULT_YES = 1,
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)enum MessageBoxType {
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MESSAGE_BOX_TYPE_INFORMATION,
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MESSAGE_BOX_TYPE_WARNING,
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MESSAGE_BOX_TYPE_QUESTION,
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Shows a dialog box with the given |title| and |message|. If |parent| is
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// non-NULL, the box will be made modal to the |parent|, except on Mac, where it
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// is always app-modal. If |type| is MESSAGE_BOX_TYPE_QUESTION, the box will
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// have YES and NO buttons; otherwise it will have an OK button.
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,
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                const string16& title,
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                const string16& message,
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                MessageBoxType type);
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace chrome
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_
40