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

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

Issue 15731007: Add dialog-specific styling, restore old-style task manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/window/dialog_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/base/ui_base_switches_util.h" 10 #include "ui/base/ui_base_switches_util.h"
(...skipping 21 matching lines...) Expand all
32 return switches::IsNewDialogStyleEnabled(); 32 return switches::IsNewDialogStyleEnabled();
33 } 33 }
34 34
35 // static 35 // static
36 Widget* DialogDelegate::CreateDialogWidget(DialogDelegate* dialog, 36 Widget* DialogDelegate::CreateDialogWidget(DialogDelegate* dialog,
37 gfx::NativeWindow context, 37 gfx::NativeWindow context,
38 gfx::NativeWindow parent) { 38 gfx::NativeWindow parent) {
39 views::Widget* widget = new views::Widget; 39 views::Widget* widget = new views::Widget;
40 views::Widget::InitParams params; 40 views::Widget::InitParams params;
41 params.delegate = dialog; 41 params.delegate = dialog;
42 if (DialogDelegate::UseNewStyle()) { 42 const bool use_new_style = dialog ?
43 dialog->UseNewStyleForThisDialog() : DialogDelegate::UseNewStyle();
44 if (use_new_style) {
43 // Note: Transparent widgets cannot host native Windows textfield controls. 45 // Note: Transparent widgets cannot host native Windows textfield controls.
44 params.transparent = true; 46 params.transparent = true;
45 params.remove_standard_frame = true; 47 params.remove_standard_frame = true;
46 } 48 }
47 params.context = context; 49 params.context = context;
48 params.parent = parent; 50 params.parent = parent;
49 params.top_level = true; 51 params.top_level = true;
50 widget->Init(params); 52 widget->Init(params);
51 if (DialogDelegate::UseNewStyle()) { 53 if (use_new_style) {
52 #if defined(USE_AURA) 54 #if defined(USE_AURA)
53 // TODO(msw): Add a matching shadow type and remove the bubble frame border? 55 // TODO(msw): Add a matching shadow type and remove the bubble frame border?
54 corewm::SetShadowType(widget->GetNativeWindow(), corewm::SHADOW_TYPE_NONE); 56 corewm::SetShadowType(widget->GetNativeWindow(), corewm::SHADOW_TYPE_NONE);
55 #endif 57 #endif
56 } 58 }
57 return widget; 59 return widget;
58 } 60 }
59 61
60 View* DialogDelegate::CreateExtraView() { 62 View* DialogDelegate::CreateExtraView() {
61 return NULL; 63 return NULL;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 150
149 DialogDelegate* DialogDelegate::AsDialogDelegate() { 151 DialogDelegate* DialogDelegate::AsDialogDelegate() {
150 return this; 152 return this;
151 } 153 }
152 154
153 ClientView* DialogDelegate::CreateClientView(Widget* widget) { 155 ClientView* DialogDelegate::CreateClientView(Widget* widget) {
154 return new DialogClientView(widget, GetContentsView()); 156 return new DialogClientView(widget, GetContentsView());
155 } 157 }
156 158
157 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { 159 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) {
158 return UseNewStyle() ? CreateNewStyleFrameView(widget) : 160 if (UseNewStyleForThisDialog())
159 WidgetDelegate::CreateNonClientFrameView(widget); 161 return CreateNewStyleFrameView(widget);
162 return WidgetDelegate::CreateNonClientFrameView(widget);
160 } 163 }
161 164
162 // static 165 // static
163 NonClientFrameView* DialogDelegate::CreateNewStyleFrameView(Widget* widget) { 166 NonClientFrameView* DialogDelegate::CreateNewStyleFrameView(Widget* widget) {
164 return CreateNewStyleFrameView(widget, false); 167 return CreateNewStyleFrameView(widget, false);
165 } 168 }
166 169
167 NonClientFrameView* DialogDelegate::CreateNewStyleFrameView( 170 NonClientFrameView* DialogDelegate::CreateNewStyleFrameView(
168 Widget* widget, 171 Widget* widget,
169 bool force_opaque_border) { 172 bool force_opaque_border) {
(...skipping 16 matching lines...) Expand all
186 View* titlebar_view = delegate->CreateTitlebarExtraView(); 189 View* titlebar_view = delegate->CreateTitlebarExtraView();
187 if (titlebar_view) 190 if (titlebar_view)
188 frame->SetTitlebarExtraView(titlebar_view); 191 frame->SetTitlebarExtraView(titlebar_view);
189 } 192 }
190 frame->SetShowCloseButton(widget->widget_delegate()->ShouldShowCloseButton()); 193 frame->SetShowCloseButton(widget->widget_delegate()->ShouldShowCloseButton());
191 if (force_opaque_border) 194 if (force_opaque_border)
192 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); 195 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM);
193 return frame; 196 return frame;
194 } 197 }
195 198
199 bool DialogDelegate::UseNewStyleForThisDialog() const {
200 return UseNewStyle();
201 }
202
196 const DialogClientView* DialogDelegate::GetDialogClientView() const { 203 const DialogClientView* DialogDelegate::GetDialogClientView() const {
197 return GetWidget()->client_view()->AsDialogClientView(); 204 return GetWidget()->client_view()->AsDialogClientView();
198 } 205 }
199 206
200 DialogClientView* DialogDelegate::GetDialogClientView() { 207 DialogClientView* DialogDelegate::GetDialogClientView() {
201 return GetWidget()->client_view()->AsDialogClientView(); 208 return GetWidget()->client_view()->AsDialogClientView();
202 } 209 }
203 210
204 ui::AccessibilityTypes::Role DialogDelegate::GetAccessibleWindowRole() const { 211 ui::AccessibilityTypes::Role DialogDelegate::GetAccessibleWindowRole() const {
205 return ui::AccessibilityTypes::ROLE_DIALOG; 212 return ui::AccessibilityTypes::ROLE_DIALOG;
(...skipping 19 matching lines...) Expand all
225 232
226 const Widget* DialogDelegateView::GetWidget() const { 233 const Widget* DialogDelegateView::GetWidget() const {
227 return View::GetWidget(); 234 return View::GetWidget();
228 } 235 }
229 236
230 View* DialogDelegateView::GetContentsView() { 237 View* DialogDelegateView::GetContentsView() {
231 return this; 238 return this;
232 } 239 }
233 240
234 } // namespace views 241 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/window/dialog_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698