| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_ |
| 6 #define CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/gfx/native_widget_types.h" |
| 12 #include "base/message_loop.h" |
| 13 #include "views/window/dialog_delegate.h" |
| 14 |
| 15 class MessageBoxView; |
| 16 |
| 17 class ConfirmMessageBoxDialog : public views::DialogDelegate, |
| 18 public MessageLoopForUI::Dispatcher { |
| 19 public: |
| 20 // The method blocks while the dialog is showing, and returns the the value |
| 21 // of the user choice, if the user click in Yes button it returns true, |
| 22 // otherwise false |
| 23 static bool Run(gfx::NativeWindow parent, |
| 24 const std::wstring& message_text, |
| 25 const std::wstring& window_title); |
| 26 |
| 27 virtual ~ConfirmMessageBoxDialog(); |
| 28 |
| 29 bool accepted() const { return accepted_; } |
| 30 |
| 31 // views::DialogDelegate implementation. |
| 32 virtual int GetDialogButtons() const; |
| 33 virtual std::wstring GetWindowTitle() const; |
| 34 virtual std::wstring GetDialogButtonLabel( |
| 35 MessageBoxFlags::DialogButton button) const; |
| 36 virtual bool Accept(); |
| 37 virtual bool Cancel(); |
| 38 |
| 39 // views::WindowDelegate implementation. |
| 40 virtual bool IsModal() const { return true; } |
| 41 virtual views::View* GetContentsView(); |
| 42 virtual void DeleteDelegate(); |
| 43 |
| 44 // MessageLoop::Dispatcher implementation. |
| 45 virtual bool Dispatch(const MSG& msg); |
| 46 |
| 47 private: |
| 48 ConfirmMessageBoxDialog(gfx::NativeWindow parent, |
| 49 const std::wstring& message_text, |
| 50 const std::wstring& window_title); |
| 51 |
| 52 // The message which will be shown to user. |
| 53 std::wstring message_text_; |
| 54 |
| 55 // This is the Title bar text. |
| 56 std::wstring window_title_; |
| 57 |
| 58 MessageBoxView* message_box_view_; |
| 59 |
| 60 // Returns true if the user clicks in Yes button, otherwise false |
| 61 bool accepted_; |
| 62 |
| 63 // Used to keep track of whether or not to block the message loop (still |
| 64 // waiting for the user to dismiss the dialog). |
| 65 bool is_blocking_; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(ConfirmMessageBoxDialog); |
| 68 }; |
| 69 |
| 70 #endif // CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_ |
| OLD | NEW |