Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: ui/views/window/dialog_delegate.h

Issue 2375843003: views: add Harmony dialog width support (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 14 matching lines...) Expand all
25 // 25 //
26 // DialogDelegate is an interface implemented by objects that wish to show a 26 // DialogDelegate is an interface implemented by objects that wish to show a
27 // dialog box Window. The window that is displayed uses this interface to 27 // dialog box Window. The window that is displayed uses this interface to
28 // determine how it should be displayed and notify the delegate object of 28 // determine how it should be displayed and notify the delegate object of
29 // certain events. 29 // certain events.
30 // 30 //
31 /////////////////////////////////////////////////////////////////////////////// 31 ///////////////////////////////////////////////////////////////////////////////
32 class VIEWS_EXPORT DialogDelegate : public ui::DialogModel, 32 class VIEWS_EXPORT DialogDelegate : public ui::DialogModel,
33 public WidgetDelegate { 33 public WidgetDelegate {
34 public: 34 public:
35 enum DialogWidth {
36 DIALOG_WIDTH_DEFAULT,
37 DIALOG_WIDTH_SMALL,
38 DIALOG_WIDTH_MEDIUM,
39 DIALOG_WIDTH_LARGE,
40 };
41
35 DialogDelegate(); 42 DialogDelegate();
36 ~DialogDelegate() override; 43 ~DialogDelegate() override;
37 44
38 // Creates a widget at a default location. 45 // Creates a widget at a default location.
39 static Widget* CreateDialogWidget(WidgetDelegate* delegate, 46 static Widget* CreateDialogWidget(WidgetDelegate* delegate,
40 gfx::NativeWindow context, 47 gfx::NativeWindow context,
41 gfx::NativeView parent); 48 gfx::NativeView parent);
42 49
43 // Returns the dialog widget InitParams for a given |context| or |parent|. 50 // Returns the dialog widget InitParams for a given |context| or |parent|.
44 // If |bounds| is not empty, used to initially place the dialog, otherwise 51 // If |bounds| is not empty, used to initially place the dialog, otherwise
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // gesture. By default, this calls Accept() if the only button in the dialog 87 // 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 88 // 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. 89 // window can be closed after it returns, or false if it must remain open.
83 virtual bool Close(); 90 virtual bool Close();
84 91
85 // Updates the properties and appearance of |button| which has been created 92 // Updates the properties and appearance of |button| which has been created
86 // for type |type|. Override to do special initialization above and beyond 93 // for type |type|. Override to do special initialization above and beyond
87 // the typical. 94 // the typical.
88 virtual void UpdateButton(LabelButton* button, ui::DialogButton type); 95 virtual void UpdateButton(LabelButton* button, ui::DialogButton type);
89 96
97 // Returns the dialog width this dialog should use, or DIALOG_WIDTH_DEFAULT
98 // for the default width. This value is only honored when MD secondary UI is
99 // enabled.
100 virtual DialogWidth GetDefaultDialogWidth() const;
Evan Stade 2016/09/28 16:14:37 nit: I don't think you need "Default" in this fn n
Elly Fong-Jones 2016/09/28 18:44:09 Done.
101
90 // Overridden from ui::DialogModel: 102 // Overridden from ui::DialogModel:
91 int GetDialogButtons() const override; 103 int GetDialogButtons() const override;
92 int GetDefaultDialogButton() const override; 104 int GetDefaultDialogButton() const override;
93 bool ShouldDefaultButtonBeBlue() const override; 105 bool ShouldDefaultButtonBeBlue() const override;
94 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; 106 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
95 bool IsDialogButtonEnabled(ui::DialogButton button) const override; 107 bool IsDialogButtonEnabled(ui::DialogButton button) const override;
96 108
97 // Overridden from WidgetDelegate: 109 // Overridden from WidgetDelegate:
98 View* GetInitiallyFocusedView() override; 110 View* GetInitiallyFocusedView() override;
99 DialogDelegate* AsDialogDelegate() override; 111 DialogDelegate* AsDialogDelegate() override;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // Overridden from DialogDelegate: 148 // Overridden from DialogDelegate:
137 void DeleteDelegate() override; 149 void DeleteDelegate() override;
138 Widget* GetWidget() override; 150 Widget* GetWidget() override;
139 const Widget* GetWidget() const override; 151 const Widget* GetWidget() const override;
140 View* GetContentsView() override; 152 View* GetContentsView() override;
141 153
142 // Overridden from View: 154 // Overridden from View:
143 void GetAccessibleState(ui::AXViewState* state) override; 155 void GetAccessibleState(ui::AXViewState* state) override;
144 void ViewHierarchyChanged( 156 void ViewHierarchyChanged(
145 const ViewHierarchyChangedDetails& details) override; 157 const ViewHierarchyChangedDetails& details) override;
158 gfx::Size GetPreferredSize() const override;
146 159
147 private: 160 private:
148 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); 161 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView);
149 }; 162 };
150 163
151 } // namespace views 164 } // namespace views
152 165
153 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ 166 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698