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

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

Issue 63343004: Remove DialogDelegate::UseNewStyle and unused code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Additional cleanup; sync and rebase. Created 7 years, 1 month 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 | Annotate | Revision Log
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 #include "ui/views/window/dialog_delegate.h" 5 #include "ui/views/window/dialog_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "grit/ui_strings.h" 8 #include "grit/ui_strings.h"
9 #include "ui/base/l10n/l10n_util.h" 9 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/views/bubble/bubble_border.h" 10 #include "ui/views/bubble/bubble_border.h"
11 #include "ui/views/bubble/bubble_frame_view.h" 11 #include "ui/views/bubble/bubble_frame_view.h"
12 #include "ui/views/controls/button/label_button.h" 12 #include "ui/views/controls/button/label_button.h"
13 #include "ui/views/widget/widget.h" 13 #include "ui/views/widget/widget.h"
14 #include "ui/views/widget/widget_observer.h" 14 #include "ui/views/widget/widget_observer.h"
15 #include "ui/views/window/dialog_client_view.h" 15 #include "ui/views/window/dialog_client_view.h"
16 16
17 #if defined(USE_AURA) 17 #if defined(USE_AURA)
18 #include "ui/views/corewm/shadow_types.h" 18 #include "ui/views/corewm/shadow_types.h"
19 #endif 19 #endif
20 20
21 namespace views { 21 namespace views {
22 22
23 //////////////////////////////////////////////////////////////////////////////// 23 ////////////////////////////////////////////////////////////////////////////////
24 // DialogDelegate: 24 // DialogDelegate:
25 25
26 DialogDelegate::~DialogDelegate() { 26 DialogDelegate::~DialogDelegate() {
27 } 27 }
28 28
29 // static 29 // static
30 bool DialogDelegate::UseNewStyle() {
31 return true;
32 }
33
34 // static
35 Widget* DialogDelegate::CreateDialogWidget(DialogDelegate* dialog, 30 Widget* DialogDelegate::CreateDialogWidget(DialogDelegate* dialog,
36 gfx::NativeWindow context, 31 gfx::NativeWindow context,
37 gfx::NativeWindow parent) { 32 gfx::NativeWindow parent) {
38 views::Widget* widget = new views::Widget; 33 views::Widget* widget = new views::Widget;
39 views::Widget::InitParams params; 34 views::Widget::InitParams params;
40 params.delegate = dialog; 35 params.delegate = dialog;
41 if (!dialog || dialog->UseNewStyleForThisDialog()) { 36 if (!dialog || dialog->UseNewStyleForThisDialog()) {
42 params.opacity = Widget::InitParams::TRANSLUCENT_WINDOW; 37 params.opacity = Widget::InitParams::TRANSLUCENT_WINDOW;
43 params.remove_standard_frame = true; 38 params.remove_standard_frame = true;
44 } 39 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 DialogDelegate* DialogDelegate::AsDialogDelegate() { 141 DialogDelegate* DialogDelegate::AsDialogDelegate() {
147 return this; 142 return this;
148 } 143 }
149 144
150 ClientView* DialogDelegate::CreateClientView(Widget* widget) { 145 ClientView* DialogDelegate::CreateClientView(Widget* widget) {
151 return new DialogClientView(widget, GetContentsView()); 146 return new DialogClientView(widget, GetContentsView());
152 } 147 }
153 148
154 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { 149 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) {
155 if (UseNewStyleForThisDialog()) 150 if (UseNewStyleForThisDialog())
156 return CreateNewStyleFrameView(widget); 151 return CreateDialogFrameView(widget);
157 return WidgetDelegate::CreateNonClientFrameView(widget); 152 return WidgetDelegate::CreateNonClientFrameView(widget);
158 } 153 }
159 154
160 // static 155 // static
161 NonClientFrameView* DialogDelegate::CreateNewStyleFrameView(Widget* widget) { 156 NonClientFrameView* DialogDelegate::CreateDialogFrameView(Widget* widget) {
162 return CreateNewStyleFrameView(widget, false); 157 return CreateDialogFrameView(widget, false);
163 } 158 }
164 159
165 // static 160 // static
166 NonClientFrameView* DialogDelegate::CreateNewStyleFrameView( 161 NonClientFrameView* DialogDelegate::CreateDialogFrameView(
167 Widget* widget, 162 Widget* widget,
168 bool force_opaque_border) { 163 bool force_opaque_border) {
169 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets()); 164 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets());
170 const SkColor color = widget->GetNativeTheme()->GetSystemColor( 165 const SkColor color = widget->GetNativeTheme()->GetSystemColor(
171 ui::NativeTheme::kColorId_DialogBackground); 166 ui::NativeTheme::kColorId_DialogBackground);
172 if (force_opaque_border) { 167 if (force_opaque_border) {
173 frame->SetBubbleBorder(new BubbleBorder( 168 frame->SetBubbleBorder(new BubbleBorder(
174 BubbleBorder::NONE, 169 BubbleBorder::NONE,
175 BubbleBorder::NO_SHADOW_OPAQUE_BORDER, 170 BubbleBorder::NO_SHADOW_OPAQUE_BORDER,
176 color)); 171 color));
(...skipping 11 matching lines...) Expand all
188 if (force_opaque_border) 183 if (force_opaque_border)
189 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); 184 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM);
190 #if defined(USE_AURA) 185 #if defined(USE_AURA)
191 // TODO(msw): Add a matching shadow type and remove the bubble frame border? 186 // TODO(msw): Add a matching shadow type and remove the bubble frame border?
192 corewm::SetShadowType(widget->GetNativeWindow(), corewm::SHADOW_TYPE_NONE); 187 corewm::SetShadowType(widget->GetNativeWindow(), corewm::SHADOW_TYPE_NONE);
193 #endif 188 #endif
194 return frame; 189 return frame;
195 } 190 }
196 191
197 bool DialogDelegate::UseNewStyleForThisDialog() const { 192 bool DialogDelegate::UseNewStyleForThisDialog() const {
198 return UseNewStyle(); 193 return true;
199 } 194 }
200 195
201 const DialogClientView* DialogDelegate::GetDialogClientView() const { 196 const DialogClientView* DialogDelegate::GetDialogClientView() const {
202 return GetWidget()->client_view()->AsDialogClientView(); 197 return GetWidget()->client_view()->AsDialogClientView();
203 } 198 }
204 199
205 DialogClientView* DialogDelegate::GetDialogClientView() { 200 DialogClientView* DialogDelegate::GetDialogClientView() {
206 return GetWidget()->client_view()->AsDialogClientView(); 201 return GetWidget()->client_view()->AsDialogClientView();
207 } 202 }
208 203
(...skipping 21 matching lines...) Expand all
230 225
231 const Widget* DialogDelegateView::GetWidget() const { 226 const Widget* DialogDelegateView::GetWidget() const {
232 return View::GetWidget(); 227 return View::GetWidget();
233 } 228 }
234 229
235 View* DialogDelegateView::GetContentsView() { 230 View* DialogDelegateView::GetContentsView() {
236 return this; 231 return this;
237 } 232 }
238 233
239 } // namespace views 234 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698