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

Side by Side Diff: ui/views/test/test_views_delegate.cc

Issue 280863002: Reduce creation of ViewsDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add widget includes for undef CreateWindow Created 6 years, 7 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 | « chrome/test/base/browser_with_test_window_test.cc ('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/test/test_views_delegate.h" 5 #include "ui/views/test/test_views_delegate.h"
6 6
7 #include "ui/wm/core/wm_state.h" 7 #include "ui/wm/core/wm_state.h"
8 8
9 9
10 namespace views { 10 namespace views {
11 11
12 TestViewsDelegate::TestViewsDelegate() 12 TestViewsDelegate::TestViewsDelegate()
13 : use_transparent_windows_(false) { 13 : use_transparent_windows_(false) {
14 DCHECK(!ViewsDelegate::views_delegate); 14 DCHECK(!ViewsDelegate::views_delegate);
15 ViewsDelegate::views_delegate = this; 15 ViewsDelegate::views_delegate = this;
16 wm_state_.reset(new wm::WMState); 16 wm_state_.reset(new wm::WMState);
17 } 17 }
18 18
19 TestViewsDelegate::~TestViewsDelegate() { 19 TestViewsDelegate::~TestViewsDelegate() {
20 ViewsDelegate::views_delegate = NULL; 20 if (ViewsDelegate::views_delegate == this)
21 ViewsDelegate::views_delegate = NULL;
21 } 22 }
22 23
23 void TestViewsDelegate::SetUseTransparentWindows(bool transparent) { 24 void TestViewsDelegate::SetUseTransparentWindows(bool transparent) {
24 use_transparent_windows_ = transparent; 25 use_transparent_windows_ = transparent;
25 } 26 }
26 27
27 void TestViewsDelegate::OnBeforeWidgetInit( 28 void TestViewsDelegate::OnBeforeWidgetInit(
28 Widget::InitParams* params, 29 Widget::InitParams* params,
29 internal::NativeWidgetDelegate* delegate) { 30 internal::NativeWidgetDelegate* delegate) {
30 if (params->opacity == Widget::InitParams::INFER_OPACITY) { 31 if (params->opacity == Widget::InitParams::INFER_OPACITY) {
31 params->opacity = use_transparent_windows_ ? 32 params->opacity = use_transparent_windows_ ?
32 Widget::InitParams::TRANSLUCENT_WINDOW : 33 Widget::InitParams::TRANSLUCENT_WINDOW :
33 Widget::InitParams::OPAQUE_WINDOW; 34 Widget::InitParams::OPAQUE_WINDOW;
34 } 35 }
35 } 36 }
36 37
37 } // namespace views 38 } // namespace views
OLDNEW
« no previous file with comments | « chrome/test/base/browser_with_test_window_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698