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/ime/input_method_win.h" | 16 #include "ui/base/ime/input_method_win.h" |
17 #include "ui/base/win/shell.h" | 17 #include "ui/base/win/shell.h" |
18 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
19 #include "ui/gfx/path_win.h" | 19 #include "ui/gfx/path_win.h" |
20 #include "ui/native_theme/native_theme_aura.h" | 20 #include "ui/native_theme/native_theme_aura.h" |
21 #include "ui/native_theme/native_theme_win.h" | 21 #include "ui/native_theme/native_theme_win.h" |
22 #include "ui/ui_controls/ui_controls.h" | 22 #include "ui/ui_controls/ui_controls.h" |
23 #include "ui/views/corewm/compound_event_filter.h" | 23 #include "ui/views/corewm/compound_event_filter.h" |
24 #include "ui/views/corewm/input_method_event_filter.h" | 24 #include "ui/views/corewm/input_method_event_filter.h" |
25 #include "ui/views/ime/input_method_bridge.h" | 25 #include "ui/views/ime/input_method_bridge.h" |
26 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" | 26 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" |
27 #include "ui/views/widget/desktop_aura/desktop_cursor_client.h" | 27 #include "ui/views/widget/desktop_aura/desktop_cursor_client.h" |
28 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" | 28 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" |
| 29 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" |
29 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 30 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
30 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" | 31 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" |
| 32 #include "ui/views/widget/root_view.h" |
31 #include "ui/views/widget/widget_delegate.h" | 33 #include "ui/views/widget/widget_delegate.h" |
32 #include "ui/views/widget/widget_hwnd_utils.h" | 34 #include "ui/views/widget/widget_hwnd_utils.h" |
33 #include "ui/views/win/fullscreen_handler.h" | 35 #include "ui/views/win/fullscreen_handler.h" |
34 #include "ui/views/win/hwnd_message_handler.h" | 36 #include "ui/views/win/hwnd_message_handler.h" |
35 #include "ui/views/window/native_frame_view.h" | 37 #include "ui/views/window/native_frame_view.h" |
36 | 38 |
37 namespace views { | 39 namespace views { |
38 | 40 |
39 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); | 41 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); |
40 | 42 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 125 |
124 activation_client_.reset(new DesktopActivationClient(root_window_)); | 126 activation_client_.reset(new DesktopActivationClient(root_window_)); |
125 | 127 |
126 dispatcher_client_.reset(new DesktopDispatcherClient); | 128 dispatcher_client_.reset(new DesktopDispatcherClient); |
127 aura::client::SetDispatcherClient(root_window_, | 129 aura::client::SetDispatcherClient(root_window_, |
128 dispatcher_client_.get()); | 130 dispatcher_client_.get()); |
129 | 131 |
130 cursor_client_.reset(new DesktopCursorClient(root_window_)); | 132 cursor_client_.reset(new DesktopCursorClient(root_window_)); |
131 aura::client::SetCursorClient(root_window_, cursor_client_.get()); | 133 aura::client::SetCursorClient(root_window_, cursor_client_.get()); |
132 | 134 |
133 | |
134 position_client_.reset(new DesktopScreenPositionClient()); | 135 position_client_.reset(new DesktopScreenPositionClient()); |
135 aura::client::SetScreenPositionClient(root_window_, | 136 aura::client::SetScreenPositionClient(root_window_, |
136 position_client_.get()); | 137 position_client_.get()); |
137 | 138 |
138 desktop_native_widget_aura_->InstallInputMethodEventFilter(root_window_); | 139 desktop_native_widget_aura_->InstallInputMethodEventFilter(root_window_); |
139 | 140 |
| 141 drag_drop_client_.reset(new DesktopDragDropClientWin(root_window_, |
| 142 GetHWND())); |
| 143 aura::client::SetDragDropClient(root_window_, drag_drop_client_.get()); |
| 144 |
140 focus_client_->FocusWindow(content_window_, NULL); | 145 focus_client_->FocusWindow(content_window_, NULL); |
141 root_window_->SetProperty(kContentWindowForRootWindow, content_window_); | 146 root_window_->SetProperty(kContentWindowForRootWindow, content_window_); |
142 | 147 |
143 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_)); | 148 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_)); |
144 return root_window_; | 149 return root_window_; |
145 } | 150 } |
146 | 151 |
147 void DesktopRootWindowHostWin::Close() { | 152 void DesktopRootWindowHostWin::Close() { |
148 message_handler_->Close(); | 153 message_handler_->Close(); |
149 } | 154 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // Match the logic in HWNDMessageHandler::ClientAreaSizeChanged(). | 371 // Match the logic in HWNDMessageHandler::ClientAreaSizeChanged(). |
367 return WidgetSizeIsClientSize() ? | 372 return WidgetSizeIsClientSize() ? |
368 GetClientAreaBoundsInScreen() : GetWindowBoundsInScreen(); | 373 GetClientAreaBoundsInScreen() : GetWindowBoundsInScreen(); |
369 } | 374 } |
370 | 375 |
371 void DesktopRootWindowHostWin::SetBounds(const gfx::Rect& bounds) { | 376 void DesktopRootWindowHostWin::SetBounds(const gfx::Rect& bounds) { |
372 message_handler_->SetBounds(bounds); | 377 message_handler_->SetBounds(bounds); |
373 } | 378 } |
374 | 379 |
375 gfx::Point DesktopRootWindowHostWin::GetLocationOnNativeScreen() const { | 380 gfx::Point DesktopRootWindowHostWin::GetLocationOnNativeScreen() const { |
376 return gfx::Point(1, 1); | 381 RECT r; |
| 382 GetWindowRect(GetHWND(), &r); |
| 383 return gfx::Point(r.left, r.top); |
377 } | 384 } |
378 | 385 |
379 void DesktopRootWindowHostWin::SetCapture() { | 386 void DesktopRootWindowHostWin::SetCapture() { |
380 message_handler_->SetCapture(); | 387 message_handler_->SetCapture(); |
381 } | 388 } |
382 | 389 |
383 void DesktopRootWindowHostWin::ReleaseCapture() { | 390 void DesktopRootWindowHostWin::ReleaseCapture() { |
384 message_handler_->ReleaseCapture(); | 391 message_handler_->ReleaseCapture(); |
385 } | 392 } |
386 | 393 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 } | 588 } |
582 | 589 |
583 void DesktopRootWindowHostWin::HandleCreate() { | 590 void DesktopRootWindowHostWin::HandleCreate() { |
584 // TODO(beng): moar | 591 // TODO(beng): moar |
585 NOTIMPLEMENTED(); | 592 NOTIMPLEMENTED(); |
586 | 593 |
587 native_widget_delegate_->OnNativeWidgetCreated(); | 594 native_widget_delegate_->OnNativeWidgetCreated(); |
588 | 595 |
589 // 1. Window property association | 596 // 1. Window property association |
590 // 2. MouseWheel. | 597 // 2. MouseWheel. |
591 // 3. Drop target. | 598 // 3. Tooltip Manager. |
592 // 4. Tooltip Manager. | |
593 } | 599 } |
594 | 600 |
595 void DesktopRootWindowHostWin::HandleDestroying() { | 601 void DesktopRootWindowHostWin::HandleDestroying() { |
| 602 drag_drop_client_->OnNativeWidgetDestroying(GetHWND()); |
596 native_widget_delegate_->OnNativeWidgetDestroying(); | 603 native_widget_delegate_->OnNativeWidgetDestroying(); |
597 } | 604 } |
598 | 605 |
599 void DesktopRootWindowHostWin::HandleDestroyed() { | 606 void DesktopRootWindowHostWin::HandleDestroyed() { |
600 desktop_native_widget_aura_->OnHostClosed(); | 607 desktop_native_widget_aura_->OnHostClosed(); |
601 } | 608 } |
602 | 609 |
603 bool DesktopRootWindowHostWin::HandleInitialFocus() { | 610 bool DesktopRootWindowHostWin::HandleInitialFocus() { |
604 return GetWidget()->SetInitialFocus(); | 611 return GetWidget()->SetInitialFocus(); |
605 } | 612 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 766 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
760 internal::NativeWidgetDelegate* native_widget_delegate, | 767 internal::NativeWidgetDelegate* native_widget_delegate, |
761 DesktopNativeWidgetAura* desktop_native_widget_aura, | 768 DesktopNativeWidgetAura* desktop_native_widget_aura, |
762 const gfx::Rect& initial_bounds) { | 769 const gfx::Rect& initial_bounds) { |
763 return new DesktopRootWindowHostWin(native_widget_delegate, | 770 return new DesktopRootWindowHostWin(native_widget_delegate, |
764 desktop_native_widget_aura, | 771 desktop_native_widget_aura, |
765 initial_bounds); | 772 initial_bounds); |
766 } | 773 } |
767 | 774 |
768 } // namespace views | 775 } // namespace views |
OLD | NEW |