| 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/desktop_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "ui/aura/client/activation_client.h" | 8 #include "ui/aura/client/activation_client.h" |
| 9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
| 10 #include "ui/aura/client/stacking_client.h" | 10 #include "ui/aura/client/stacking_client.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "ui/views/corewm/corewm_switches.h" | 26 #include "ui/views/corewm/corewm_switches.h" |
| 27 #include "ui/views/corewm/input_method_event_filter.h" | 27 #include "ui/views/corewm/input_method_event_filter.h" |
| 28 #include "ui/views/corewm/shadow_controller.h" | 28 #include "ui/views/corewm/shadow_controller.h" |
| 29 #include "ui/views/corewm/shadow_types.h" | 29 #include "ui/views/corewm/shadow_types.h" |
| 30 #include "ui/views/corewm/tooltip_controller.h" | 30 #include "ui/views/corewm/tooltip_controller.h" |
| 31 #include "ui/views/corewm/visibility_controller.h" | 31 #include "ui/views/corewm/visibility_controller.h" |
| 32 #include "ui/views/corewm/window_modality_controller.h" | 32 #include "ui/views/corewm/window_modality_controller.h" |
| 33 #include "ui/views/drag_utils.h" | 33 #include "ui/views/drag_utils.h" |
| 34 #include "ui/views/ime/input_method.h" | 34 #include "ui/views/ime/input_method.h" |
| 35 #include "ui/views/ime/input_method_bridge.h" | 35 #include "ui/views/ime/input_method_bridge.h" |
| 36 #include "ui/views/view_constants_aura.h" |
| 36 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" | 37 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" |
| 37 #include "ui/views/widget/drop_helper.h" | 38 #include "ui/views/widget/drop_helper.h" |
| 38 #include "ui/views/widget/native_widget_aura_window_observer.h" | 39 #include "ui/views/widget/native_widget_aura_window_observer.h" |
| 40 #include "ui/views/widget/native_widget_layer_reorderer_aura.h" |
| 39 #include "ui/views/widget/root_view.h" | 41 #include "ui/views/widget/root_view.h" |
| 40 #include "ui/views/widget/tooltip_manager_aura.h" | 42 #include "ui/views/widget/tooltip_manager_aura.h" |
| 41 #include "ui/views/widget/widget.h" | 43 #include "ui/views/widget/widget.h" |
| 42 #include "ui/views/widget/widget_aura_utils.h" | 44 #include "ui/views/widget/widget_aura_utils.h" |
| 43 #include "ui/views/widget/widget_delegate.h" | 45 #include "ui/views/widget/widget_delegate.h" |
| 44 | 46 |
| 45 DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(VIEWS_EXPORT, | 47 DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(VIEWS_EXPORT, |
| 46 views::DesktopNativeWidgetAura*); | 48 views::DesktopNativeWidgetAura*); |
| 47 | 49 |
| 48 namespace views { | 50 namespace views { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } | 265 } |
| 264 | 266 |
| 265 window_->Show(); | 267 window_->Show(); |
| 266 desktop_root_window_host_->InitFocus(window_); | 268 desktop_root_window_host_->InitFocus(window_); |
| 267 | 269 |
| 268 aura::client::SetActivationDelegate(window_, this); | 270 aura::client::SetActivationDelegate(window_, this); |
| 269 | 271 |
| 270 shadow_controller_.reset( | 272 shadow_controller_.reset( |
| 271 new corewm::ShadowController( | 273 new corewm::ShadowController( |
| 272 aura::client::GetActivationClient(root_window_.get()))); | 274 aura::client::GetActivationClient(root_window_.get()))); |
| 275 |
| 276 layer_reorderer_.reset(new NativeWidgetLayerReordererAura( |
| 277 window_, GetWidget()->GetRootView())); |
| 273 } | 278 } |
| 274 | 279 |
| 275 NonClientFrameView* DesktopNativeWidgetAura::CreateNonClientFrameView() { | 280 NonClientFrameView* DesktopNativeWidgetAura::CreateNonClientFrameView() { |
| 276 return desktop_root_window_host_->CreateNonClientFrameView(); | 281 return desktop_root_window_host_->CreateNonClientFrameView(); |
| 277 } | 282 } |
| 278 | 283 |
| 279 bool DesktopNativeWidgetAura::ShouldUseNativeFrame() const { | 284 bool DesktopNativeWidgetAura::ShouldUseNativeFrame() const { |
| 280 return desktop_root_window_host_->ShouldUseNativeFrame(); | 285 return desktop_root_window_host_->ShouldUseNativeFrame(); |
| 281 } | 286 } |
| 282 | 287 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 312 return window_->layer()->GetCompositor(); | 317 return window_->layer()->GetCompositor(); |
| 313 } | 318 } |
| 314 | 319 |
| 315 gfx::Vector2d DesktopNativeWidgetAura::CalculateOffsetToAncestorWithLayer( | 320 gfx::Vector2d DesktopNativeWidgetAura::CalculateOffsetToAncestorWithLayer( |
| 316 ui::Layer** layer_parent) { | 321 ui::Layer** layer_parent) { |
| 317 if (layer_parent) | 322 if (layer_parent) |
| 318 *layer_parent = window_->layer(); | 323 *layer_parent = window_->layer(); |
| 319 return gfx::Vector2d(); | 324 return gfx::Vector2d(); |
| 320 } | 325 } |
| 321 | 326 |
| 327 void DesktopNativeWidgetAura::ReorderLayers() { |
| 328 layer_reorderer_->ReorderLayers(); |
| 329 } |
| 330 |
| 331 bool DesktopNativeWidgetAura::HasNativeViewAttachedToViewTree() const { |
| 332 // TODO(pkotwicz): Set the the kHostViewKey property when a |
| 333 // NativeViewHost attaches a NativeView to |window_|. |
| 334 const std::vector<aura::Window*>& child_windows = window_->children(); |
| 335 for (size_t i = 0; i < child_windows.size(); ++i) { |
| 336 if (child_windows[i]->GetProperty(kHostViewKey)) |
| 337 return true; |
| 338 } |
| 339 return false; |
| 340 } |
| 341 |
| 322 void DesktopNativeWidgetAura::ViewRemoved(View* view) { | 342 void DesktopNativeWidgetAura::ViewRemoved(View* view) { |
| 323 } | 343 } |
| 324 | 344 |
| 325 void DesktopNativeWidgetAura::SetNativeWindowProperty(const char* name, | 345 void DesktopNativeWidgetAura::SetNativeWindowProperty(const char* name, |
| 326 void* value) { | 346 void* value) { |
| 327 window_->SetNativeWindowProperty(name, value); | 347 window_->SetNativeWindowProperty(name, value); |
| 328 } | 348 } |
| 329 | 349 |
| 330 void* DesktopNativeWidgetAura::GetNativeWindowProperty(const char* name) const { | 350 void* DesktopNativeWidgetAura::GetNativeWindowProperty(const char* name) const { |
| 331 return window_->GetNativeWindowProperty(name); | 351 return window_->GetNativeWindowProperty(name); |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 drop_helper_->OnDragExit(); | 859 drop_helper_->OnDragExit(); |
| 840 } | 860 } |
| 841 | 861 |
| 842 int DesktopNativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) { | 862 int DesktopNativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) { |
| 843 DCHECK(drop_helper_.get() != NULL); | 863 DCHECK(drop_helper_.get() != NULL); |
| 844 return drop_helper_->OnDrop(event.data(), event.location(), | 864 return drop_helper_->OnDrop(event.data(), event.location(), |
| 845 last_drop_operation_); | 865 last_drop_operation_); |
| 846 } | 866 } |
| 847 | 867 |
| 848 } // namespace views | 868 } // namespace views |
| OLD | NEW |