Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_SIMPLE_MESSAGE_BOX_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_SIMPLE_MESSAGE_BOX_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_SIMPLE_MESSAGE_BOX_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_SIMPLE_MESSAGE_BOX_VIEWS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 public base::RefCounted<SimpleMessageBoxViews> { | 22 public base::RefCounted<SimpleMessageBoxViews> { |
| 23 public: | 23 public: |
| 24 static void ShowErrorBox(gfx::NativeWindow parent_window, | 24 static void ShowErrorBox(gfx::NativeWindow parent_window, |
| 25 const string16& title, | 25 const string16& title, |
| 26 const string16& message); | 26 const string16& message); |
| 27 static bool ShowYesNoBox(gfx::NativeWindow parent_window, | 27 static bool ShowYesNoBox(gfx::NativeWindow parent_window, |
| 28 const string16& title, | 28 const string16& title, |
| 29 const string16& message); | 29 const string16& message); |
| 30 | 30 |
| 31 // Returns true if the Accept button was clicked. | 31 // Returns true if the Accept button was clicked. |
| 32 bool accepted() const { return disposition_ == DISPOSITION_OK; } | 32 bool accepted() const { return disposition_type_ == DISPOSITION_OK; } |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 friend class base::RefCounted<SimpleMessageBoxViews>; | 35 friend class base::RefCounted<SimpleMessageBoxViews>; |
| 36 | 36 |
| 37 // The state of the dialog when closing. | 37 // The state of the dialog when closing. |
| 38 enum DispositionType { | 38 enum DispositionType { |
| 39 DISPOSITION_UNKNOWN, | 39 DISPOSITION_UNKNOWN, |
| 40 DISPOSITION_CANCEL, | 40 DISPOSITION_CANCEL, |
| 41 DISPOSITION_OK | 41 DISPOSITION_OK |
| 42 }; | 42 }; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 54 | 54 |
| 55 // Overridden from views::WidgetDelegate: | 55 // Overridden from views::WidgetDelegate: |
| 56 virtual string16 GetWindowTitle() const OVERRIDE; | 56 virtual string16 GetWindowTitle() const OVERRIDE; |
| 57 virtual void DeleteDelegate() OVERRIDE; | 57 virtual void DeleteDelegate() OVERRIDE; |
| 58 virtual ui::ModalType GetModalType() const OVERRIDE; | 58 virtual ui::ModalType GetModalType() const OVERRIDE; |
| 59 virtual views::View* GetContentsView() OVERRIDE; | 59 virtual views::View* GetContentsView() OVERRIDE; |
| 60 virtual views::Widget* GetWidget() OVERRIDE; | 60 virtual views::Widget* GetWidget() OVERRIDE; |
| 61 virtual const views::Widget* GetWidget() const OVERRIDE; | 61 virtual const views::Widget* GetWidget() const OVERRIDE; |
| 62 | 62 |
| 63 SimpleMessageBoxViews(gfx::NativeWindow parent_window, | 63 SimpleMessageBoxViews(gfx::NativeWindow parent_window, |
| 64 DialogType type, | 64 DialogType dialog_type, |
| 65 const string16& title, | 65 const string16& title, |
| 66 const string16& message); | 66 const string16& message); |
| 67 virtual ~SimpleMessageBoxViews(); | 67 virtual ~SimpleMessageBoxViews(); |
| 68 | 68 |
| 69 // MessageLoop::Dispatcher implementation. | 69 // MessageLoop::Dispatcher implementation. |
| 70 // Dispatcher method. This returns true if the menu was canceled, or | 70 // Dispatcher method. This returns true if the menu was canceled, or |
| 71 // if the message is such that the menu should be closed. | 71 // if the message is such that the menu should be closed. |
| 72 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 72 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
| 73 | 73 |
| 74 const DialogType type_; | 74 const DialogType dialog_type_; |
| 75 string16 message_box_title_; | 75 DispositionType disposition_type_; |
|
Peter Kasting
2012/04/13 09:12:32
Nit: While it's not wrong, I don't think the |disp
| |
| 76 const string16 window_title_; | |
| 76 views::MessageBoxView* message_box_view_; | 77 views::MessageBoxView* message_box_view_; |
| 77 DispositionType disposition_; | |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(SimpleMessageBoxViews); | 79 DISALLOW_COPY_AND_ASSIGN(SimpleMessageBoxViews); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 #endif // CHROME_BROWSER_UI_VIEWS_SIMPLE_MESSAGE_BOX_VIEWS_H_ | 82 #endif // CHROME_BROWSER_UI_VIEWS_SIMPLE_MESSAGE_BOX_VIEWS_H_ |
| OLD | NEW |