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

Side by Side Diff: ui/views/widget/widget.cc

Issue 1159033008: Refactor ViewsDelegate singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Destroy ash ViewsDelegate Created 5 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
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | ui/views/widget/widget_delegate.cc » ('j') | 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/widget/widget.h" 5 #include "ui/views/widget/widget.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 InitParams params = in_params; 307 InitParams params = in_params;
308 308
309 params.child |= (params.type == InitParams::TYPE_CONTROL); 309 params.child |= (params.type == InitParams::TYPE_CONTROL);
310 is_top_level_ = !params.child; 310 is_top_level_ = !params.child;
311 311
312 if (params.opacity == views::Widget::InitParams::INFER_OPACITY && 312 if (params.opacity == views::Widget::InitParams::INFER_OPACITY &&
313 params.type != views::Widget::InitParams::TYPE_WINDOW && 313 params.type != views::Widget::InitParams::TYPE_WINDOW &&
314 params.type != views::Widget::InitParams::TYPE_PANEL) 314 params.type != views::Widget::InitParams::TYPE_PANEL)
315 params.opacity = views::Widget::InitParams::OPAQUE_WINDOW; 315 params.opacity = views::Widget::InitParams::OPAQUE_WINDOW;
316 316
317 if (ViewsDelegate::views_delegate) 317 if (ViewsDelegate::GetInstance())
318 ViewsDelegate::views_delegate->OnBeforeWidgetInit(&params, this); 318 ViewsDelegate::GetInstance()->OnBeforeWidgetInit(&params, this);
319 319
320 if (params.opacity == views::Widget::InitParams::INFER_OPACITY) 320 if (params.opacity == views::Widget::InitParams::INFER_OPACITY)
321 params.opacity = views::Widget::InitParams::OPAQUE_WINDOW; 321 params.opacity = views::Widget::InitParams::OPAQUE_WINDOW;
322 322
323 bool can_activate = false; 323 bool can_activate = false;
324 if (params.activatable != InitParams::ACTIVATABLE_DEFAULT) { 324 if (params.activatable != InitParams::ACTIVATABLE_DEFAULT) {
325 can_activate = (params.activatable == InitParams::ACTIVATABLE_YES); 325 can_activate = (params.activatable == InitParams::ACTIVATABLE_YES);
326 } else if (params.type != InitParams::TYPE_CONTROL && 326 } else if (params.type != InitParams::TYPE_CONTROL &&
327 params.type != InitParams::TYPE_POPUP && 327 params.type != InitParams::TYPE_POPUP &&
328 params.type != InitParams::TYPE_MENU && 328 params.type != InitParams::TYPE_MENU &&
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 888
889 void Widget::ClearNativeFocus() { 889 void Widget::ClearNativeFocus() {
890 native_widget_->ClearNativeFocus(); 890 native_widget_->ClearNativeFocus();
891 } 891 }
892 892
893 NonClientFrameView* Widget::CreateNonClientFrameView() { 893 NonClientFrameView* Widget::CreateNonClientFrameView() {
894 NonClientFrameView* frame_view = 894 NonClientFrameView* frame_view =
895 widget_delegate_->CreateNonClientFrameView(this); 895 widget_delegate_->CreateNonClientFrameView(this);
896 if (!frame_view) 896 if (!frame_view)
897 frame_view = native_widget_->CreateNonClientFrameView(); 897 frame_view = native_widget_->CreateNonClientFrameView();
898 if (!frame_view && ViewsDelegate::views_delegate) { 898 if (!frame_view && ViewsDelegate::GetInstance()) {
899 frame_view = 899 frame_view =
900 ViewsDelegate::views_delegate->CreateDefaultNonClientFrameView(this); 900 ViewsDelegate::GetInstance()->CreateDefaultNonClientFrameView(this);
901 } 901 }
902 if (frame_view) 902 if (frame_view)
903 return frame_view; 903 return frame_view;
904 904
905 CustomFrameView* custom_frame_view = new CustomFrameView; 905 CustomFrameView* custom_frame_view = new CustomFrameView;
906 custom_frame_view->Init(this); 906 custom_frame_view->Init(this);
907 return custom_frame_view; 907 return custom_frame_view;
908 } 908 }
909 909
910 bool Widget::ShouldUseNativeFrame() const { 910 bool Widget::ShouldUseNativeFrame() const {
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 1530
1531 //////////////////////////////////////////////////////////////////////////////// 1531 ////////////////////////////////////////////////////////////////////////////////
1532 // internal::NativeWidgetPrivate, NativeWidget implementation: 1532 // internal::NativeWidgetPrivate, NativeWidget implementation:
1533 1533
1534 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1534 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1535 return this; 1535 return this;
1536 } 1536 }
1537 1537
1538 } // namespace internal 1538 } // namespace internal
1539 } // namespace views 1539 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | ui/views/widget/widget_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698