| OLD | NEW |
| 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" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "services/ui/public/interfaces/window_manager.mojom.h" | 14 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 15 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 15 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 16 #include "third_party/skia/include/core/SkRegion.h" | 16 #include "third_party/skia/include/core/SkRegion.h" |
| 17 #include "ui/aura/client/aura_constants.h" | 17 #include "ui/aura/client/aura_constants.h" |
| 18 #include "ui/aura/client/capture_client.h" | 18 #include "ui/aura/client/capture_client.h" |
| 19 #include "ui/aura/client/cursor_client.h" | 19 #include "ui/aura/client/cursor_client.h" |
| 20 #include "ui/aura/client/drag_drop_client.h" | 20 #include "ui/aura/client/drag_drop_client.h" |
| 21 #include "ui/aura/client/focus_client.h" | 21 #include "ui/aura/client/focus_client.h" |
| 22 #include "ui/aura/client/screen_position_client.h" | 22 #include "ui/aura/client/screen_position_client.h" |
| 23 #include "ui/aura/client/window_parenting_client.h" | 23 #include "ui/aura/client/window_parenting_client.h" |
| 24 #include "ui/aura/env.h" | 24 #include "ui/aura/env.h" |
| 25 #include "ui/aura/mus/property_utils.h" |
| 25 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
| 26 #include "ui/aura/window_event_dispatcher.h" | 27 #include "ui/aura/window_event_dispatcher.h" |
| 27 #include "ui/aura/window_observer.h" | 28 #include "ui/aura/window_observer.h" |
| 28 #include "ui/aura/window_property.h" | 29 #include "ui/aura/window_property.h" |
| 29 #include "ui/aura/window_tree_host.h" | 30 #include "ui/aura/window_tree_host.h" |
| 30 #include "ui/base/dragdrop/os_exchange_data.h" | 31 #include "ui/base/dragdrop/os_exchange_data.h" |
| 31 #include "ui/base/ui_base_types.h" | 32 #include "ui/base/ui_base_types.h" |
| 32 #include "ui/compositor/layer.h" | 33 #include "ui/compositor/layer.h" |
| 33 #include "ui/display/display.h" | 34 #include "ui/display/display.h" |
| 34 #include "ui/display/screen.h" | 35 #include "ui/display/screen.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // NativeWidgetAura, internal::NativeWidgetPrivate implementation: | 135 // NativeWidgetAura, internal::NativeWidgetPrivate implementation: |
| 135 | 136 |
| 136 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { | 137 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { |
| 137 // Aura needs to know which desktop (Ash or regular) will manage this widget. | 138 // Aura needs to know which desktop (Ash or regular) will manage this widget. |
| 138 // See Widget::InitParams::context for details. | 139 // See Widget::InitParams::context for details. |
| 139 DCHECK(params.parent || params.context); | 140 DCHECK(params.parent || params.context); |
| 140 | 141 |
| 141 ownership_ = params.ownership; | 142 ownership_ = params.ownership; |
| 142 | 143 |
| 143 RegisterNativeWidgetForWindow(this, window_); | 144 RegisterNativeWidgetForWindow(this, window_); |
| 144 window_->SetType(GetAuraWindowTypeForWidgetType(params.type)); | 145 // MusClient has assertions that ui::mojom::WindowType matches |
| 146 // views::Widget::InitParams::Type. |
| 147 aura::SetWindowType(window_, static_cast<ui::mojom::WindowType>(params.type)); |
| 145 window_->SetProperty(aura::client::kShowStateKey, params.show_state); | 148 window_->SetProperty(aura::client::kShowStateKey, params.show_state); |
| 146 if (params.type == Widget::InitParams::TYPE_BUBBLE) | 149 if (params.type == Widget::InitParams::TYPE_BUBBLE) |
| 147 aura::client::SetHideOnDeactivate(window_, true); | 150 aura::client::SetHideOnDeactivate(window_, true); |
| 148 window_->SetTransparent( | 151 window_->SetTransparent( |
| 149 params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW); | 152 params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW); |
| 150 window_->Init(params.layer_type); | 153 window_->Init(params.layer_type); |
| 151 // Set name after layer init so it propagates to layer. | 154 // Set name after layer init so it propagates to layer. |
| 152 window_->SetName(params.name); | 155 window_->SetName(params.name); |
| 153 if (params.shadow_type == Widget::InitParams::SHADOW_TYPE_NONE) { | 156 if (params.shadow_type == Widget::InitParams::SHADOW_TYPE_NONE) { |
| 154 SetShadowElevation(window_, wm::ShadowElevation::NONE); | 157 SetShadowElevation(window_, wm::ShadowElevation::NONE); |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 gfx::NativeView native_view) { | 1239 gfx::NativeView native_view) { |
| 1237 aura::client::CaptureClient* capture_client = | 1240 aura::client::CaptureClient* capture_client = |
| 1238 aura::client::GetCaptureClient(native_view->GetRootWindow()); | 1241 aura::client::GetCaptureClient(native_view->GetRootWindow()); |
| 1239 if (!capture_client) | 1242 if (!capture_client) |
| 1240 return nullptr; | 1243 return nullptr; |
| 1241 return capture_client->GetGlobalCaptureWindow(); | 1244 return capture_client->GetGlobalCaptureWindow(); |
| 1242 } | 1245 } |
| 1243 | 1246 |
| 1244 } // namespace internal | 1247 } // namespace internal |
| 1245 } // namespace views | 1248 } // namespace views |
| OLD | NEW |