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/widget/native_widget_aura.cc

Issue 2694213003: mash: wires up shadows for mash (Closed)
Patch Set: defaults test Created 3 years, 10 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.h ('k') | ui/wm/core/shadow.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/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // static 123 // static
124 void NativeWidgetAura::AssignIconToAuraWindow(aura::Window* window, 124 void NativeWidgetAura::AssignIconToAuraWindow(aura::Window* window,
125 const gfx::ImageSkia& window_icon, 125 const gfx::ImageSkia& window_icon,
126 const gfx::ImageSkia& app_icon) { 126 const gfx::ImageSkia& app_icon) {
127 if (window) { 127 if (window) {
128 SetIcon(window, aura::client::kWindowIconKey, window_icon); 128 SetIcon(window, aura::client::kWindowIconKey, window_icon);
129 SetIcon(window, aura::client::kAppIconKey, app_icon); 129 SetIcon(window, aura::client::kAppIconKey, app_icon);
130 } 130 }
131 } 131 }
132 132
133 // static
134 void NativeWidgetAura::SetShadowElevationFromInitParams(
135 aura::Window* window,
136 const Widget::InitParams& params) {
137 if (params.shadow_type == Widget::InitParams::SHADOW_TYPE_NONE) {
138 SetShadowElevation(window, wm::ShadowElevation::NONE);
139 } else if (params.shadow_type == Widget::InitParams::SHADOW_TYPE_DROP &&
140 params.shadow_elevation) {
141 SetShadowElevation(window, *params.shadow_elevation);
142 }
143 }
144
133 //////////////////////////////////////////////////////////////////////////////// 145 ////////////////////////////////////////////////////////////////////////////////
134 // NativeWidgetAura, internal::NativeWidgetPrivate implementation: 146 // NativeWidgetAura, internal::NativeWidgetPrivate implementation:
135 147
136 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { 148 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
137 // Aura needs to know which desktop (Ash or regular) will manage this widget. 149 // Aura needs to know which desktop (Ash or regular) will manage this widget.
138 // See Widget::InitParams::context for details. 150 // See Widget::InitParams::context for details.
139 DCHECK(params.parent || params.context); 151 DCHECK(params.parent || params.context);
140 152
141 ownership_ = params.ownership; 153 ownership_ = params.ownership;
142 154
143 RegisterNativeWidgetForWindow(this, window_); 155 RegisterNativeWidgetForWindow(this, window_);
144 // MusClient has assertions that ui::mojom::WindowType matches 156 // MusClient has assertions that ui::mojom::WindowType matches
145 // views::Widget::InitParams::Type. 157 // views::Widget::InitParams::Type.
146 aura::SetWindowType(window_, static_cast<ui::mojom::WindowType>(params.type)); 158 aura::SetWindowType(window_, static_cast<ui::mojom::WindowType>(params.type));
147 window_->SetProperty(aura::client::kShowStateKey, params.show_state); 159 window_->SetProperty(aura::client::kShowStateKey, params.show_state);
148 if (params.type == Widget::InitParams::TYPE_BUBBLE) 160 if (params.type == Widget::InitParams::TYPE_BUBBLE)
149 aura::client::SetHideOnDeactivate(window_, true); 161 aura::client::SetHideOnDeactivate(window_, true);
150 window_->SetTransparent( 162 window_->SetTransparent(
151 params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW); 163 params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW);
152 window_->Init(params.layer_type); 164 window_->Init(params.layer_type);
153 // Set name after layer init so it propagates to layer. 165 // Set name after layer init so it propagates to layer.
154 window_->SetName(params.name); 166 window_->SetName(params.name);
155 if (params.shadow_type == Widget::InitParams::SHADOW_TYPE_NONE) { 167 SetShadowElevationFromInitParams(window_, params);
156 SetShadowElevation(window_, wm::ShadowElevation::NONE);
157 } else if (params.shadow_type == Widget::InitParams::SHADOW_TYPE_DROP &&
158 params.shadow_elevation) {
159 SetShadowElevation(window_, *params.shadow_elevation);
160 }
161 if (params.type == Widget::InitParams::TYPE_CONTROL) 168 if (params.type == Widget::InitParams::TYPE_CONTROL)
162 window_->Show(); 169 window_->Show();
163 170
164 delegate_->OnNativeWidgetCreated(false); 171 delegate_->OnNativeWidgetCreated(false);
165 172
166 gfx::Rect window_bounds = params.bounds; 173 gfx::Rect window_bounds = params.bounds;
167 gfx::NativeView parent = params.parent; 174 gfx::NativeView parent = params.parent;
168 gfx::NativeView context = params.context; 175 gfx::NativeView context = params.context;
169 if (!params.child) { 176 if (!params.child) {
170 // Set up the transient child before the window is added. This way the 177 // Set up the transient child before the window is added. This way the
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 gfx::NativeView native_view) { 1212 gfx::NativeView native_view) {
1206 aura::client::CaptureClient* capture_client = 1213 aura::client::CaptureClient* capture_client =
1207 aura::client::GetCaptureClient(native_view->GetRootWindow()); 1214 aura::client::GetCaptureClient(native_view->GetRootWindow());
1208 if (!capture_client) 1215 if (!capture_client)
1209 return nullptr; 1216 return nullptr;
1210 return capture_client->GetGlobalCaptureWindow(); 1217 return capture_client->GetGlobalCaptureWindow();
1211 } 1218 }
1212 1219
1213 } // namespace internal 1220 } // namespace internal
1214 } // namespace views 1221 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/wm/core/shadow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698