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

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

Issue 108193005: Fixing opacity for browser frame window on ASH/Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review changes. Created 7 years 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/widget/widget.h" 5 #include "ui/views/widget/widget.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 DISALLOW_COPY_AND_ASSIGN(DefaultWidgetDelegate); 105 DISALLOW_COPY_AND_ASSIGN(DefaultWidgetDelegate);
106 }; 106 };
107 107
108 //////////////////////////////////////////////////////////////////////////////// 108 ////////////////////////////////////////////////////////////////////////////////
109 // Widget, InitParams: 109 // Widget, InitParams:
110 110
111 Widget::InitParams::InitParams() 111 Widget::InitParams::InitParams()
112 : type(TYPE_WINDOW), 112 : type(TYPE_WINDOW),
113 delegate(NULL), 113 delegate(NULL),
114 child(false), 114 child(false),
115 opacity((ViewsDelegate::views_delegate && 115 opacity(INFER_OPACITY),
116 ViewsDelegate::views_delegate->UseTransparentWindows()) ?
117 TRANSLUCENT_WINDOW : INFER_OPACITY),
118 accept_events(true), 116 accept_events(true),
119 can_activate(true), 117 can_activate(true),
120 keep_on_top(false), 118 keep_on_top(false),
121 ownership(NATIVE_WIDGET_OWNS_WIDGET), 119 ownership(NATIVE_WIDGET_OWNS_WIDGET),
122 mirror_origin_in_rtl(false), 120 mirror_origin_in_rtl(false),
123 has_dropshadow(false), 121 has_dropshadow(false),
124 remove_standard_frame(false), 122 remove_standard_frame(false),
125 use_system_default_icon(false), 123 use_system_default_icon(false),
126 show_state(ui::SHOW_STATE_DEFAULT), 124 show_state(ui::SHOW_STATE_DEFAULT),
127 double_buffer(false), 125 double_buffer(false),
128 parent(NULL), 126 parent(NULL),
129 native_widget(NULL), 127 native_widget(NULL),
130 desktop_root_window_host(NULL), 128 desktop_root_window_host(NULL),
131 top_level(false), 129 top_level(false),
132 layer_type(ui::LAYER_TEXTURED), 130 layer_type(ui::LAYER_TEXTURED),
133 context(NULL) { 131 context(NULL) {
134 } 132 }
135 133
136 Widget::InitParams::InitParams(Type type) 134 Widget::InitParams::InitParams(Type type)
137 : type(type), 135 : type(type),
138 delegate(NULL), 136 delegate(NULL),
139 child(type == TYPE_CONTROL), 137 child(type == TYPE_CONTROL),
140 opacity(((type == TYPE_WINDOW || type == TYPE_PANEL) && 138 opacity(INFER_OPACITY),
141 ViewsDelegate::views_delegate &&
142 ViewsDelegate::views_delegate->UseTransparentWindows()) ?
143 TRANSLUCENT_WINDOW : INFER_OPACITY),
144 accept_events(true), 139 accept_events(true),
145 can_activate(type != TYPE_POPUP && type != TYPE_MENU && 140 can_activate(type != TYPE_POPUP && type != TYPE_MENU &&
146 type != TYPE_DRAG), 141 type != TYPE_DRAG),
147 keep_on_top(type == TYPE_MENU || type == TYPE_DRAG), 142 keep_on_top(type == TYPE_MENU || type == TYPE_DRAG),
148 ownership(NATIVE_WIDGET_OWNS_WIDGET), 143 ownership(NATIVE_WIDGET_OWNS_WIDGET),
149 mirror_origin_in_rtl(false), 144 mirror_origin_in_rtl(false),
150 has_dropshadow(false), 145 has_dropshadow(false),
151 remove_standard_frame(false), 146 remove_standard_frame(false),
152 use_system_default_icon(false), 147 use_system_default_icon(false),
153 show_state(ui::SHOW_STATE_DEFAULT), 148 show_state(ui::SHOW_STATE_DEFAULT),
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 337
343 void Widget::Init(const InitParams& in_params) { 338 void Widget::Init(const InitParams& in_params) {
344 TRACE_EVENT0("views", "Widget::Init"); 339 TRACE_EVENT0("views", "Widget::Init");
345 InitParams params = in_params; 340 InitParams params = in_params;
346 341
347 is_top_level_ = params.top_level || 342 is_top_level_ = params.top_level ||
348 (!params.child && 343 (!params.child &&
349 params.type != InitParams::TYPE_CONTROL && 344 params.type != InitParams::TYPE_CONTROL &&
350 params.type != InitParams::TYPE_TOOLTIP); 345 params.type != InitParams::TYPE_TOOLTIP);
351 params.top_level = is_top_level_; 346 params.top_level = is_top_level_;
352 if (params.opacity == InitParams::INFER_OPACITY) {
353 #if defined(OS_WIN) && defined(USE_AURA)
354 // By default, make all top-level windows but the main window transparent
355 // initially so that they can be made to fade in.
356 if (is_top_level_ && params.type != InitParams::TYPE_WINDOW)
357 params.opacity = InitParams::TRANSLUCENT_WINDOW;
358 else
359 params.opacity = InitParams::OPAQUE_WINDOW;
360 #else
361 params.opacity = InitParams::OPAQUE_WINDOW;
362 #endif
363 }
364 347
365 if (ViewsDelegate::views_delegate) 348 if (ViewsDelegate::views_delegate)
366 ViewsDelegate::views_delegate->OnBeforeWidgetInit(&params, this); 349 ViewsDelegate::views_delegate->OnBeforeWidgetInit(&params, this);
367 350
351 if (params.opacity == views::Widget::InitParams::INFER_OPACITY) {
sky 2013/12/17 19:14:23 nit: no {}
Shrikant Kelkar 2013/12/17 22:43:34 Done.
352 params.opacity = views::Widget::InitParams::OPAQUE_WINDOW;
353 }
354
368 widget_delegate_ = params.delegate ? 355 widget_delegate_ = params.delegate ?
369 params.delegate : new DefaultWidgetDelegate(this, params); 356 params.delegate : new DefaultWidgetDelegate(this, params);
370 ownership_ = params.ownership; 357 ownership_ = params.ownership;
371 native_widget_ = CreateNativeWidget(params.native_widget, this)-> 358 native_widget_ = CreateNativeWidget(params.native_widget, this)->
372 AsNativeWidgetPrivate(); 359 AsNativeWidgetPrivate();
373 root_view_.reset(CreateRootView()); 360 root_view_.reset(CreateRootView());
374 default_theme_provider_.reset(new ui::DefaultThemeProvider); 361 default_theme_provider_.reset(new ui::DefaultThemeProvider);
375 if (params.type == InitParams::TYPE_MENU) { 362 if (params.type == InitParams::TYPE_MENU) {
376 is_mouse_button_pressed_ = 363 is_mouse_button_pressed_ =
377 internal::NativeWidgetPrivate::IsMouseButtonDown(); 364 internal::NativeWidgetPrivate::IsMouseButtonDown();
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 1417
1431 //////////////////////////////////////////////////////////////////////////////// 1418 ////////////////////////////////////////////////////////////////////////////////
1432 // internal::NativeWidgetPrivate, NativeWidget implementation: 1419 // internal::NativeWidgetPrivate, NativeWidget implementation:
1433 1420
1434 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1421 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1435 return this; 1422 return this;
1436 } 1423 }
1437 1424
1438 } // namespace internal 1425 } // namespace internal
1439 } // namespace views 1426 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698