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

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

Issue 2375843003: views: add Harmony dialog width support (Closed)
Patch Set: GetPreferredSize -> DialogClientView 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // Returns true if this particular dialog should use a Chrome-styled frame 106 // Returns true if this particular dialog should use a Chrome-styled frame
107 // like the one used for bubbles. The alternative is a more platform-native 107 // like the one used for bubbles. The alternative is a more platform-native
108 // frame. 108 // frame.
109 virtual bool ShouldUseCustomFrame() const; 109 virtual bool ShouldUseCustomFrame() const;
110 110
111 // A helper for accessing the DialogClientView object contained by this 111 // A helper for accessing the DialogClientView object contained by this
112 // delegate's Window. 112 // delegate's Window.
113 const DialogClientView* GetDialogClientView() const; 113 const DialogClientView* GetDialogClientView() const;
114 DialogClientView* GetDialogClientView(); 114 DialogClientView* GetDialogClientView();
115 115
116 // Returns this dialog's width factor, if it has one. If it does not,
117 // returns zero.
118 int GetWidthFactor() const;
Evan Stade 2016/10/05 19:52:29 I would expect this to either return an int that i
119
116 protected: 120 protected:
117 // Overridden from WidgetDelegate: 121 // Overridden from WidgetDelegate:
118 ui::AXRole GetAccessibleWindowRole() const override; 122 ui::AXRole GetAccessibleWindowRole() const override;
119 123
124 // These values are in the 32px units the Harmony spec uses.
Evan Stade 2016/10/05 19:52:29 a/units/increments
125 enum class DialogWidth {
126 UNSPECIFIED = 0,
127 SMALL = 10,
128 MEDIUM = 14,
129 LARGE = 16,
130 };
131
132 void set_dialog_width(DialogWidth width) { dialog_width_ = width; }
133
120 private: 134 private:
121 // A flag indicating whether this dialog is able to use the custom frame 135 // A flag indicating whether this dialog is able to use the custom frame
122 // style for dialogs. 136 // style for dialogs.
123 bool supports_custom_frame_; 137 bool supports_custom_frame_;
138
139 DialogWidth dialog_width_ = DialogWidth::UNSPECIFIED;
124 }; 140 };
125 141
126 // A DialogDelegate implementation that is-a View. Used to override GetWidget() 142 // A DialogDelegate implementation that is-a View. Used to override GetWidget()
127 // to call View's GetWidget() for the common case where a DialogDelegate 143 // to call View's GetWidget() for the common case where a DialogDelegate
128 // implementation is-a View. Note that DialogDelegateView is not owned by 144 // implementation is-a View. Note that DialogDelegateView is not owned by
129 // view's hierarchy and is expected to be deleted on DeleteDelegate call. 145 // view's hierarchy and is expected to be deleted on DeleteDelegate call.
130 class VIEWS_EXPORT DialogDelegateView : public DialogDelegate, 146 class VIEWS_EXPORT DialogDelegateView : public DialogDelegate,
131 public View { 147 public View {
132 public: 148 public:
133 DialogDelegateView(); 149 DialogDelegateView();
(...skipping 10 matching lines...) Expand all
144 void ViewHierarchyChanged( 160 void ViewHierarchyChanged(
145 const ViewHierarchyChangedDetails& details) override; 161 const ViewHierarchyChangedDetails& details) override;
146 162
147 private: 163 private:
148 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); 164 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView);
149 }; 165 };
150 166
151 } // namespace views 167 } // namespace views
152 168
153 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ 169 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698