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/ui_controls_aura.h" | 13 #include "ui/aura/ui_controls_aura.h" |
14 #include "ui/aura/window_property.h" | 14 #include "ui/aura/window_property.h" |
15 #include "ui/base/cursor/cursor_loader_win.h" | 15 #include "ui/base/cursor/cursor_loader_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/ui_controls/ui_controls.h" | 21 #include "ui/ui_controls/ui_controls.h" |
22 #include "ui/views/corewm/compound_event_filter.h" | 22 #include "ui/views/corewm/compound_event_filter.h" |
23 #include "ui/views/corewm/input_method_event_filter.h" | 23 #include "ui/views/corewm/input_method_event_filter.h" |
24 #include "ui/views/ime/input_method_win.h" | 24 #include "ui/views/ime/input_method_win.h" |
25 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" | 25 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" |
26 #include "ui/views/widget/desktop_aura/desktop_cursor_client.h" | 26 #include "ui/views/widget/desktop_aura/desktop_cursor_client.h" |
27 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" | 27 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" |
| 28 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" |
28 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 29 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
29 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" | 30 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" |
| 31 #include "ui/views/widget/root_view.h" |
30 #include "ui/views/widget/widget_delegate.h" | 32 #include "ui/views/widget/widget_delegate.h" |
31 #include "ui/views/widget/widget_hwnd_utils.h" | 33 #include "ui/views/widget/widget_hwnd_utils.h" |
32 #include "ui/views/win/fullscreen_handler.h" | 34 #include "ui/views/win/fullscreen_handler.h" |
33 #include "ui/views/win/hwnd_message_handler.h" | 35 #include "ui/views/win/hwnd_message_handler.h" |
34 #include "ui/views/window/native_frame_view.h" | 36 #include "ui/views/window/native_frame_view.h" |
35 | 37 |
36 namespace views { | 38 namespace views { |
37 | 39 |
38 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); | 40 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); |
39 | 41 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 124 |
123 activation_client_.reset(new DesktopActivationClient(root_window_)); | 125 activation_client_.reset(new DesktopActivationClient(root_window_)); |
124 | 126 |
125 dispatcher_client_.reset(new DesktopDispatcherClient); | 127 dispatcher_client_.reset(new DesktopDispatcherClient); |
126 aura::client::SetDispatcherClient(root_window_, | 128 aura::client::SetDispatcherClient(root_window_, |
127 dispatcher_client_.get()); | 129 dispatcher_client_.get()); |
128 | 130 |
129 cursor_client_.reset(new DesktopCursorClient(root_window_)); | 131 cursor_client_.reset(new DesktopCursorClient(root_window_)); |
130 aura::client::SetCursorClient(root_window_, cursor_client_.get()); | 132 aura::client::SetCursorClient(root_window_, cursor_client_.get()); |
131 | 133 |
132 | |
133 position_client_.reset(new DesktopScreenPositionClient()); | 134 position_client_.reset(new DesktopScreenPositionClient()); |
134 aura::client::SetScreenPositionClient(root_window_, | 135 aura::client::SetScreenPositionClient(root_window_, |
135 position_client_.get()); | 136 position_client_.get()); |
136 | 137 |
| 138 drag_drop_client_.reset(new DesktopDragDropClientWin(root_window_, |
| 139 GetHWND())); |
| 140 aura::client::SetDragDropClient(root_window_, drag_drop_client_.get()); |
| 141 |
137 // CEF sets focus to the window the user clicks down on. | 142 // CEF sets focus to the window the user clicks down on. |
138 // TODO(beng): see if we can't do this some other way. CEF seems a heavy- | 143 // TODO(beng): see if we can't do this some other way. CEF seems a heavy- |
139 // handed way of accomplishing focus. | 144 // handed way of accomplishing focus. |
140 root_window_event_filter_ = new views::corewm::CompoundEventFilter; | 145 root_window_event_filter_ = new views::corewm::CompoundEventFilter; |
141 root_window_->SetEventFilter(root_window_event_filter_); | 146 root_window_->SetEventFilter(root_window_event_filter_); |
142 | 147 |
143 input_method_filter_.reset(new views::corewm::InputMethodEventFilter); | 148 input_method_filter_.reset(new views::corewm::InputMethodEventFilter); |
144 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_); | 149 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_); |
145 root_window_event_filter_->AddHandler(input_method_filter_.get()); | 150 root_window_event_filter_->AddHandler(input_method_filter_.get()); |
146 | 151 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 // Match the logic in HWNDMessageHandler::ClientAreaSizeChanged(). | 397 // Match the logic in HWNDMessageHandler::ClientAreaSizeChanged(). |
393 return WidgetSizeIsClientSize() ? | 398 return WidgetSizeIsClientSize() ? |
394 GetClientAreaBoundsInScreen() : GetWindowBoundsInScreen(); | 399 GetClientAreaBoundsInScreen() : GetWindowBoundsInScreen(); |
395 } | 400 } |
396 | 401 |
397 void DesktopRootWindowHostWin::SetBounds(const gfx::Rect& bounds) { | 402 void DesktopRootWindowHostWin::SetBounds(const gfx::Rect& bounds) { |
398 message_handler_->SetBounds(bounds); | 403 message_handler_->SetBounds(bounds); |
399 } | 404 } |
400 | 405 |
401 gfx::Point DesktopRootWindowHostWin::GetLocationOnNativeScreen() const { | 406 gfx::Point DesktopRootWindowHostWin::GetLocationOnNativeScreen() const { |
402 return gfx::Point(1, 1); | 407 RECT r; |
| 408 GetWindowRect(GetHWND(), &r); |
| 409 return gfx::Point(r.left, r.top); |
403 } | 410 } |
404 | 411 |
405 void DesktopRootWindowHostWin::SetCapture() { | 412 void DesktopRootWindowHostWin::SetCapture() { |
406 message_handler_->SetCapture(); | 413 message_handler_->SetCapture(); |
407 } | 414 } |
408 | 415 |
409 void DesktopRootWindowHostWin::ReleaseCapture() { | 416 void DesktopRootWindowHostWin::ReleaseCapture() { |
410 message_handler_->ReleaseCapture(); | 417 message_handler_->ReleaseCapture(); |
411 } | 418 } |
412 | 419 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 } | 614 } |
608 | 615 |
609 void DesktopRootWindowHostWin::HandleCreate() { | 616 void DesktopRootWindowHostWin::HandleCreate() { |
610 // TODO(beng): moar | 617 // TODO(beng): moar |
611 NOTIMPLEMENTED(); | 618 NOTIMPLEMENTED(); |
612 | 619 |
613 native_widget_delegate_->OnNativeWidgetCreated(); | 620 native_widget_delegate_->OnNativeWidgetCreated(); |
614 | 621 |
615 // 1. Window property association | 622 // 1. Window property association |
616 // 2. MouseWheel. | 623 // 2. MouseWheel. |
617 // 3. Drop target. | 624 // 3. Tooltip Manager. |
618 // 4. Tooltip Manager. | |
619 } | 625 } |
620 | 626 |
621 void DesktopRootWindowHostWin::HandleDestroying() { | 627 void DesktopRootWindowHostWin::HandleDestroying() { |
| 628 drag_drop_client_->OnNativeWidgetDestroying(GetHWND()); |
622 native_widget_delegate_->OnNativeWidgetDestroying(); | 629 native_widget_delegate_->OnNativeWidgetDestroying(); |
623 } | 630 } |
624 | 631 |
625 void DesktopRootWindowHostWin::HandleDestroyed() { | 632 void DesktopRootWindowHostWin::HandleDestroyed() { |
626 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); | 633 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); |
627 desktop_native_widget_aura_->OnHostClosed(); | 634 desktop_native_widget_aura_->OnHostClosed(); |
628 } | 635 } |
629 | 636 |
630 bool DesktopRootWindowHostWin::HandleInitialFocus() { | 637 bool DesktopRootWindowHostWin::HandleInitialFocus() { |
631 return GetWidget()->SetInitialFocus(); | 638 return GetWidget()->SetInitialFocus(); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 794 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
788 internal::NativeWidgetDelegate* native_widget_delegate, | 795 internal::NativeWidgetDelegate* native_widget_delegate, |
789 DesktopNativeWidgetAura* desktop_native_widget_aura, | 796 DesktopNativeWidgetAura* desktop_native_widget_aura, |
790 const gfx::Rect& initial_bounds) { | 797 const gfx::Rect& initial_bounds) { |
791 return new DesktopRootWindowHostWin(native_widget_delegate, | 798 return new DesktopRootWindowHostWin(native_widget_delegate, |
792 desktop_native_widget_aura, | 799 desktop_native_widget_aura, |
793 initial_bounds); | 800 initial_bounds); |
794 } | 801 } |
795 | 802 |
796 } // namespace views | 803 } // namespace views |
OLD | NEW |