| 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/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "ui/gfx/point_conversions.h" | 22 #include "ui/gfx/point_conversions.h" |
| 23 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
| 24 #include "ui/gfx/size_conversions.h" | 24 #include "ui/gfx/size_conversions.h" |
| 25 #include "ui/native_theme/native_theme.h" | 25 #include "ui/native_theme/native_theme.h" |
| 26 #include "ui/views/corewm/capture_controller.h" | 26 #include "ui/views/corewm/capture_controller.h" |
| 27 #include "ui/views/corewm/compound_event_filter.h" | 27 #include "ui/views/corewm/compound_event_filter.h" |
| 28 #include "ui/views/corewm/corewm_switches.h" | 28 #include "ui/views/corewm/corewm_switches.h" |
| 29 #include "ui/views/corewm/input_method_event_filter.h" | 29 #include "ui/views/corewm/input_method_event_filter.h" |
| 30 #include "ui/views/corewm/shadow_controller.h" | 30 #include "ui/views/corewm/shadow_controller.h" |
| 31 #include "ui/views/corewm/shadow_types.h" | 31 #include "ui/views/corewm/shadow_types.h" |
| 32 #include "ui/views/corewm/tooltip_controller.h" | |
| 33 #include "ui/views/corewm/visibility_controller.h" | 32 #include "ui/views/corewm/visibility_controller.h" |
| 34 #include "ui/views/corewm/window_modality_controller.h" | 33 #include "ui/views/corewm/window_modality_controller.h" |
| 35 #include "ui/views/drag_utils.h" | 34 #include "ui/views/drag_utils.h" |
| 36 #include "ui/views/ime/input_method.h" | 35 #include "ui/views/ime/input_method.h" |
| 37 #include "ui/views/ime/input_method_bridge.h" | 36 #include "ui/views/ime/input_method_bridge.h" |
| 38 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" | 37 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" |
| 38 #include "ui/views/widget/desktop_aura/scoped_tooltip_client.h" |
| 39 #include "ui/views/widget/drop_helper.h" | 39 #include "ui/views/widget/drop_helper.h" |
| 40 #include "ui/views/widget/native_widget_aura.h" | 40 #include "ui/views/widget/native_widget_aura.h" |
| 41 #include "ui/views/widget/native_widget_aura_window_observer.h" | 41 #include "ui/views/widget/native_widget_aura_window_observer.h" |
| 42 #include "ui/views/widget/root_view.h" | 42 #include "ui/views/widget/root_view.h" |
| 43 #include "ui/views/widget/tooltip_manager_aura.h" | 43 #include "ui/views/widget/tooltip_manager_aura.h" |
| 44 #include "ui/views/widget/widget.h" | 44 #include "ui/views/widget/widget.h" |
| 45 #include "ui/views/widget/widget_aura_utils.h" | 45 #include "ui/views/widget/widget_aura_utils.h" |
| 46 #include "ui/views/widget/widget_delegate.h" | 46 #include "ui/views/widget/widget_delegate.h" |
| 47 #include "ui/views/widget/window_reorderer.h" | 47 #include "ui/views/widget/window_reorderer.h" |
| 48 | 48 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 desktop_root_window_host_->Init(window_, params)); | 253 desktop_root_window_host_->Init(window_, params)); |
| 254 root_window_->AddRootWindowObserver(this); | 254 root_window_->AddRootWindowObserver(this); |
| 255 | 255 |
| 256 stacking_client_.reset( | 256 stacking_client_.reset( |
| 257 new DesktopNativeWidgetAuraStackingClient(root_window_.get())); | 257 new DesktopNativeWidgetAuraStackingClient(root_window_.get())); |
| 258 drop_helper_.reset(new DropHelper( | 258 drop_helper_.reset(new DropHelper( |
| 259 static_cast<internal::RootView*>(GetWidget()->GetRootView()))); | 259 static_cast<internal::RootView*>(GetWidget()->GetRootView()))); |
| 260 aura::client::SetDragDropDelegate(window_, this); | 260 aura::client::SetDragDropDelegate(window_, this); |
| 261 | 261 |
| 262 tooltip_manager_.reset(new views::TooltipManagerAura(window_, GetWidget())); | 262 tooltip_manager_.reset(new views::TooltipManagerAura(window_, GetWidget())); |
| 263 tooltip_controller_.reset( | 263 |
| 264 new corewm::TooltipController(gfx::SCREEN_TYPE_NATIVE)); | 264 scoped_tooltip_client_.reset(new ScopedTooltipClient(root_window_.get())); |
| 265 aura::client::SetTooltipClient(root_window_.get(), | |
| 266 tooltip_controller_.get()); | |
| 267 root_window_->AddPreTargetHandler(tooltip_controller_.get()); | |
| 268 | 265 |
| 269 if (params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW) { | 266 if (params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW) { |
| 270 visibility_controller_.reset(new views::corewm::VisibilityController); | 267 visibility_controller_.reset(new views::corewm::VisibilityController); |
| 271 aura::client::SetVisibilityClient(GetNativeView()->GetRootWindow(), | 268 aura::client::SetVisibilityClient(GetNativeView()->GetRootWindow(), |
| 272 visibility_controller_.get()); | 269 visibility_controller_.get()); |
| 273 views::corewm::SetChildWindowVisibilityChangesAnimated( | 270 views::corewm::SetChildWindowVisibilityChangesAnimated( |
| 274 GetNativeView()->GetRootWindow()); | 271 GetNativeView()->GetRootWindow()); |
| 275 } | 272 } |
| 276 | 273 |
| 277 if (params.type == Widget::InitParams::TYPE_WINDOW) { | 274 if (params.type == Widget::InitParams::TYPE_WINDOW) { |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 void DesktopNativeWidgetAura::OnDeviceScaleFactorChanged( | 710 void DesktopNativeWidgetAura::OnDeviceScaleFactorChanged( |
| 714 float device_scale_factor) { | 711 float device_scale_factor) { |
| 715 } | 712 } |
| 716 | 713 |
| 717 void DesktopNativeWidgetAura::OnWindowDestroying() { | 714 void DesktopNativeWidgetAura::OnWindowDestroying() { |
| 718 // DesktopRootWindowHost owns the ActivationController which ShadowController | 715 // DesktopRootWindowHost owns the ActivationController which ShadowController |
| 719 // references. Make sure we destroy ShadowController early on. | 716 // references. Make sure we destroy ShadowController early on. |
| 720 shadow_controller_.reset(); | 717 shadow_controller_.reset(); |
| 721 // The DesktopRootWindowHost implementation sends OnNativeWidgetDestroying(). | 718 // The DesktopRootWindowHost implementation sends OnNativeWidgetDestroying(). |
| 722 tooltip_manager_.reset(); | 719 tooltip_manager_.reset(); |
| 723 if (tooltip_controller_.get()) { | 720 scoped_tooltip_client_.reset(); |
| 724 root_window_->RemovePreTargetHandler(tooltip_controller_.get()); | |
| 725 tooltip_controller_.reset(); | |
| 726 aura::client::SetTooltipClient(root_window_.get(), NULL); | |
| 727 } | |
| 728 if (window_modality_controller_) { | 721 if (window_modality_controller_) { |
| 729 root_window_->RemovePreTargetHandler(window_modality_controller_.get()); | 722 root_window_->RemovePreTargetHandler(window_modality_controller_.get()); |
| 730 window_modality_controller_.reset(); | 723 window_modality_controller_.reset(); |
| 731 } | 724 } |
| 732 } | 725 } |
| 733 | 726 |
| 734 void DesktopNativeWidgetAura::OnWindowDestroyed() { | 727 void DesktopNativeWidgetAura::OnWindowDestroyed() { |
| 735 window_ = NULL; | 728 window_ = NULL; |
| 736 native_widget_delegate_->OnNativeWidgetDestroyed(); | 729 native_widget_delegate_->OnNativeWidgetDestroyed(); |
| 737 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) | 730 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 } | 923 } |
| 931 | 924 |
| 932 //////////////////////////////////////////////////////////////////////////////// | 925 //////////////////////////////////////////////////////////////////////////////// |
| 933 // DesktopNativeWidgetAura, NativeWidget implementation: | 926 // DesktopNativeWidgetAura, NativeWidget implementation: |
| 934 | 927 |
| 935 ui::EventHandler* DesktopNativeWidgetAura::GetEventHandler() { | 928 ui::EventHandler* DesktopNativeWidgetAura::GetEventHandler() { |
| 936 return this; | 929 return this; |
| 937 } | 930 } |
| 938 | 931 |
| 939 } // namespace views | 932 } // namespace views |
| OLD | NEW |