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_root_window_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h" |
6 | 6 |
7 #include "third_party/skia/include/core/SkPath.h" | 7 #include "third_party/skia/include/core/SkPath.h" |
8 #include "third_party/skia/include/core/SkRegion.h" | 8 #include "third_party/skia/include/core/SkRegion.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/default_capture_client.h" | 10 #include "ui/aura/client/default_capture_client.h" |
11 #include "ui/aura/focus_manager.h" | 11 #include "ui/aura/focus_manager.h" |
12 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
13 #include "ui/aura/window_property.h" | 13 #include "ui/aura/window_property.h" |
14 #include "ui/base/cursor/cursor_loader_win.h" | 14 #include "ui/base/cursor/cursor_loader_win.h" |
15 #include "ui/base/ime/input_method_win.h" | 15 #include "ui/base/ime/input_method_win.h" |
16 #include "ui/base/win/shell.h" | 16 #include "ui/base/win/shell.h" |
17 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
18 #include "ui/gfx/path_win.h" | 18 #include "ui/gfx/path_win.h" |
19 #include "ui/native_theme/native_theme_aura.h" | 19 #include "ui/native_theme/native_theme_aura.h" |
20 #include "ui/native_theme/native_theme_win.h" | 20 #include "ui/native_theme/native_theme_win.h" |
21 #include "ui/views/corewm/compound_event_filter.h" | 21 #include "ui/views/corewm/compound_event_filter.h" |
22 #include "ui/views/corewm/corewm_switches.h" | |
23 #include "ui/views/corewm/focus_controller.h" | |
24 #include "ui/views/corewm/input_method_event_filter.h" | 22 #include "ui/views/corewm/input_method_event_filter.h" |
25 #include "ui/views/ime/input_method_bridge.h" | 23 #include "ui/views/ime/input_method_bridge.h" |
26 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" | 24 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" |
27 #include "ui/views/widget/desktop_aura/desktop_cursor_client.h" | 25 #include "ui/views/widget/desktop_aura/desktop_cursor_client.h" |
28 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" | 26 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" |
29 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" | 27 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" |
30 #include "ui/views/widget/desktop_aura/desktop_focus_rules.h" | |
31 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 28 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
32 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" | 29 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" |
33 #include "ui/views/widget/root_view.h" | 30 #include "ui/views/widget/root_view.h" |
34 #include "ui/views/widget/widget_delegate.h" | 31 #include "ui/views/widget/widget_delegate.h" |
35 #include "ui/views/widget/widget_hwnd_utils.h" | 32 #include "ui/views/widget/widget_hwnd_utils.h" |
36 #include "ui/views/win/fullscreen_handler.h" | 33 #include "ui/views/win/fullscreen_handler.h" |
37 #include "ui/views/win/hwnd_message_handler.h" | 34 #include "ui/views/win/hwnd_message_handler.h" |
38 #include "ui/views/window/native_frame_view.h" | 35 #include "ui/views/window/native_frame_view.h" |
39 | 36 |
40 namespace views { | 37 namespace views { |
41 | 38 |
42 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); | 39 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); |
43 | 40 |
44 //////////////////////////////////////////////////////////////////////////////// | 41 //////////////////////////////////////////////////////////////////////////////// |
45 // DesktopRootWindowHostWin, public: | 42 // DesktopRootWindowHostWin, public: |
46 | 43 |
47 DesktopRootWindowHostWin::DesktopRootWindowHostWin( | 44 DesktopRootWindowHostWin::DesktopRootWindowHostWin( |
48 internal::NativeWidgetDelegate* native_widget_delegate, | 45 internal::NativeWidgetDelegate* native_widget_delegate, |
49 DesktopNativeWidgetAura* desktop_native_widget_aura, | 46 DesktopNativeWidgetAura* desktop_native_widget_aura, |
50 const gfx::Rect& initial_bounds) | 47 const gfx::Rect& initial_bounds) |
51 : ALLOW_THIS_IN_INITIALIZER_LIST( | 48 : ALLOW_THIS_IN_INITIALIZER_LIST( |
52 message_handler_(new HWNDMessageHandler(this))), | 49 message_handler_(new HWNDMessageHandler(this))), |
53 native_widget_delegate_(native_widget_delegate), | 50 native_widget_delegate_(native_widget_delegate), |
54 desktop_native_widget_aura_(desktop_native_widget_aura), | 51 desktop_native_widget_aura_(desktop_native_widget_aura), |
55 root_window_host_delegate_(NULL), | 52 root_window_host_delegate_(NULL), |
56 content_window_(NULL) { | 53 content_window_(NULL) { |
57 } | 54 } |
58 | 55 |
59 DesktopRootWindowHostWin::~DesktopRootWindowHostWin() { | 56 DesktopRootWindowHostWin::~DesktopRootWindowHostWin() { |
60 if (corewm::UseFocusController()) { | |
61 aura::client::SetFocusClient(root_window_, NULL); | |
62 aura::client::SetActivationClient(root_window_, NULL); | |
63 } | |
64 } | 57 } |
65 | 58 |
66 // static | 59 // static |
67 aura::Window* DesktopRootWindowHostWin::GetContentWindowForHWND(HWND hwnd) { | 60 aura::Window* DesktopRootWindowHostWin::GetContentWindowForHWND(HWND hwnd) { |
68 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(hwnd); | 61 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(hwnd); |
69 return root ? root->GetProperty(kContentWindowForRootWindow) : NULL; | 62 return root ? root->GetProperty(kContentWindowForRootWindow) : NULL; |
70 } | 63 } |
71 | 64 |
72 // static | 65 // static |
73 ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { | 66 ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 root_window_->SetTransparent(true); | 111 root_window_->SetTransparent(true); |
119 | 112 |
120 root_window_->Init(); | 113 root_window_->Init(); |
121 root_window_->AddChild(content_window_); | 114 root_window_->AddChild(content_window_); |
122 | 115 |
123 native_widget_delegate_->OnNativeWidgetCreated(); | 116 native_widget_delegate_->OnNativeWidgetCreated(); |
124 | 117 |
125 capture_client_.reset(new aura::client::DefaultCaptureClient(root_window_)); | 118 capture_client_.reset(new aura::client::DefaultCaptureClient(root_window_)); |
126 aura::client::SetCaptureClient(root_window_, capture_client_.get()); | 119 aura::client::SetCaptureClient(root_window_, capture_client_.get()); |
127 | 120 |
128 if (corewm::UseFocusController()) { | 121 focus_client_.reset(new aura::FocusManager); |
129 corewm::FocusController* focus_controller = | 122 aura::client::SetFocusClient(root_window_, focus_client_.get()); |
130 new corewm::FocusController(new DesktopFocusRules); | 123 |
131 focus_client_.reset(focus_controller); | 124 activation_client_.reset(new DesktopActivationClient(root_window_)); |
132 aura::client::SetFocusClient(root_window_, focus_controller); | |
133 aura::client::SetActivationClient(root_window_, focus_controller); | |
134 } else { | |
135 focus_client_.reset(new aura::FocusManager); | |
136 aura::client::SetFocusClient(root_window_, focus_client_.get()); | |
137 activation_client_.reset(new DesktopActivationClient(root_window_)); | |
138 } | |
139 | 125 |
140 dispatcher_client_.reset(new DesktopDispatcherClient); | 126 dispatcher_client_.reset(new DesktopDispatcherClient); |
141 aura::client::SetDispatcherClient(root_window_, | 127 aura::client::SetDispatcherClient(root_window_, |
142 dispatcher_client_.get()); | 128 dispatcher_client_.get()); |
143 | 129 |
144 cursor_client_.reset(new DesktopCursorClient(root_window_)); | 130 cursor_client_.reset(new DesktopCursorClient(root_window_)); |
145 aura::client::SetCursorClient(root_window_, cursor_client_.get()); | 131 aura::client::SetCursorClient(root_window_, cursor_client_.get()); |
146 | 132 |
147 position_client_.reset(new DesktopScreenPositionClient()); | 133 position_client_.reset(new DesktopScreenPositionClient()); |
148 aura::client::SetScreenPositionClient(root_window_, | 134 aura::client::SetScreenPositionClient(root_window_, |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 767 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
782 internal::NativeWidgetDelegate* native_widget_delegate, | 768 internal::NativeWidgetDelegate* native_widget_delegate, |
783 DesktopNativeWidgetAura* desktop_native_widget_aura, | 769 DesktopNativeWidgetAura* desktop_native_widget_aura, |
784 const gfx::Rect& initial_bounds) { | 770 const gfx::Rect& initial_bounds) { |
785 return new DesktopRootWindowHostWin(native_widget_delegate, | 771 return new DesktopRootWindowHostWin(native_widget_delegate, |
786 desktop_native_widget_aura, | 772 desktop_native_widget_aura, |
787 initial_bounds); | 773 initial_bounds); |
788 } | 774 } |
789 | 775 |
790 } // namespace views | 776 } // namespace views |
OLD | NEW |