| 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 UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ | 5 #ifndef UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ |
| 6 #define UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ | 6 #define UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "ui/accessibility/ax_enums.h" | 10 #include "ui/accessibility/ax_enums.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 virtual bool Accept(); | 76 virtual bool Accept(); |
| 77 | 77 |
| 78 // Called when the user closes the window without selecting an option, | 78 // Called when the user closes the window without selecting an option, |
| 79 // e.g. by pressing the close button on the window or using a window manager | 79 // e.g. by pressing the close button on the window or using a window manager |
| 80 // gesture. By default, this calls Accept() if the only button in the dialog | 80 // gesture. By default, this calls Accept() if the only button in the dialog |
| 81 // is Accept, Cancel() otherwise. This function should return true if the | 81 // is Accept, Cancel() otherwise. This function should return true if the |
| 82 // window can be closed after it returns, or false if it must remain open. | 82 // window can be closed after it returns, or false if it must remain open. |
| 83 virtual bool Close(); | 83 virtual bool Close(); |
| 84 | 84 |
| 85 // Overridden from ui::DialogModel: | 85 // Overridden from ui::DialogModel: |
| 86 virtual base::string16 GetDialogLabel() const OVERRIDE; | 86 virtual base::string16 GetDialogLabel() const override; |
| 87 virtual base::string16 GetDialogTitle() const OVERRIDE; | 87 virtual base::string16 GetDialogTitle() const override; |
| 88 virtual int GetDialogButtons() const OVERRIDE; | 88 virtual int GetDialogButtons() const override; |
| 89 virtual int GetDefaultDialogButton() const OVERRIDE; | 89 virtual int GetDefaultDialogButton() const override; |
| 90 virtual bool ShouldDefaultButtonBeBlue() const OVERRIDE; | 90 virtual bool ShouldDefaultButtonBeBlue() const override; |
| 91 virtual base::string16 GetDialogButtonLabel( | 91 virtual base::string16 GetDialogButtonLabel( |
| 92 ui::DialogButton button) const OVERRIDE; | 92 ui::DialogButton button) const override; |
| 93 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; | 93 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 94 | 94 |
| 95 // Overridden from WidgetDelegate: | 95 // Overridden from WidgetDelegate: |
| 96 virtual View* GetInitiallyFocusedView() OVERRIDE; | 96 virtual View* GetInitiallyFocusedView() override; |
| 97 virtual DialogDelegate* AsDialogDelegate() OVERRIDE; | 97 virtual DialogDelegate* AsDialogDelegate() override; |
| 98 virtual ClientView* CreateClientView(Widget* widget) OVERRIDE; | 98 virtual ClientView* CreateClientView(Widget* widget) override; |
| 99 virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) OVERRIDE; | 99 virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) override; |
| 100 | 100 |
| 101 // Create a frame view using the new dialog style. | 101 // Create a frame view using the new dialog style. |
| 102 static NonClientFrameView* CreateDialogFrameView(Widget* widget); | 102 static NonClientFrameView* CreateDialogFrameView(Widget* widget); |
| 103 | 103 |
| 104 // Returns whether this particular dialog should use the new dialog style. | 104 // Returns whether this particular dialog should use the new dialog style. |
| 105 virtual bool UseNewStyleForThisDialog() const; | 105 virtual bool UseNewStyleForThisDialog() const; |
| 106 | 106 |
| 107 // Called when the window has been closed. | 107 // Called when the window has been closed. |
| 108 virtual void OnClosed() {} | 108 virtual void OnClosed() {} |
| 109 | 109 |
| 110 // A helper for accessing the DialogClientView object contained by this | 110 // A helper for accessing the DialogClientView object contained by this |
| 111 // delegate's Window. | 111 // delegate's Window. |
| 112 const DialogClientView* GetDialogClientView() const; | 112 const DialogClientView* GetDialogClientView() const; |
| 113 DialogClientView* GetDialogClientView(); | 113 DialogClientView* GetDialogClientView(); |
| 114 | 114 |
| 115 protected: | 115 protected: |
| 116 // Overridden from WidgetDelegate: | 116 // Overridden from WidgetDelegate: |
| 117 virtual ui::AXRole GetAccessibleWindowRole() const OVERRIDE; | 117 virtual ui::AXRole GetAccessibleWindowRole() const override; |
| 118 | 118 |
| 119 private: | 119 private: |
| 120 // A flag indicating whether this dialog supports the new style. | 120 // A flag indicating whether this dialog supports the new style. |
| 121 bool supports_new_style_; | 121 bool supports_new_style_; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 // A DialogDelegate implementation that is-a View. Used to override GetWidget() | 124 // A DialogDelegate implementation that is-a View. Used to override GetWidget() |
| 125 // to call View's GetWidget() for the common case where a DialogDelegate | 125 // to call View's GetWidget() for the common case where a DialogDelegate |
| 126 // implementation is-a View. Note that DialogDelegateView is not owned by | 126 // implementation is-a View. Note that DialogDelegateView is not owned by |
| 127 // view's hierarchy and is expected to be deleted on DeleteDelegate call. | 127 // view's hierarchy and is expected to be deleted on DeleteDelegate call. |
| 128 class VIEWS_EXPORT DialogDelegateView : public DialogDelegate, | 128 class VIEWS_EXPORT DialogDelegateView : public DialogDelegate, |
| 129 public View { | 129 public View { |
| 130 public: | 130 public: |
| 131 DialogDelegateView(); | 131 DialogDelegateView(); |
| 132 virtual ~DialogDelegateView(); | 132 virtual ~DialogDelegateView(); |
| 133 | 133 |
| 134 // Overridden from DialogDelegate: | 134 // Overridden from DialogDelegate: |
| 135 virtual void DeleteDelegate() OVERRIDE; | 135 virtual void DeleteDelegate() override; |
| 136 virtual Widget* GetWidget() OVERRIDE; | 136 virtual Widget* GetWidget() override; |
| 137 virtual const Widget* GetWidget() const OVERRIDE; | 137 virtual const Widget* GetWidget() const override; |
| 138 virtual View* GetContentsView() OVERRIDE; | 138 virtual View* GetContentsView() override; |
| 139 | 139 |
| 140 private: | 140 private: |
| 141 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); | 141 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 } // namespace views | 144 } // namespace views |
| 145 | 145 |
| 146 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ | 146 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ |
| OLD | NEW |