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_root_window_host_win.h" | 5 #include "ui/views/widget/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/desktop/desktop_activation_client.h" | 10 #include "ui/aura/desktop/desktop_activation_client.h" |
11 #include "ui/aura/desktop/desktop_cursor_client.h" | 11 #include "ui/aura/desktop/desktop_cursor_client.h" |
12 #include "ui/aura/desktop/desktop_dispatcher_client.h" | 12 #include "ui/aura/desktop/desktop_dispatcher_client.h" |
13 #include "ui/aura/focus_manager.h" | 13 #include "ui/aura/focus_manager.h" |
14 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
15 #include "ui/aura/shared/compound_event_filter.h" | 15 #include "ui/aura/shared/compound_event_filter.h" |
16 #include "ui/aura/shared/input_method_event_filter.h" | 16 #include "ui/aura/shared/input_method_event_filter.h" |
17 #include "ui/aura/window_property.h" | 17 #include "ui/aura/window_property.h" |
18 #include "ui/base/cursor/cursor_loader_win.h" | 18 #include "ui/base/cursor/cursor_loader_win.h" |
| 19 #include "ui/base/native_theme/native_theme_aura.h" |
| 20 #include "ui/base/native_theme/native_theme_win.h" |
19 #include "ui/base/win/shell.h" | 21 #include "ui/base/win/shell.h" |
20 #include "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
21 #include "ui/gfx/path_win.h" | 23 #include "ui/gfx/path_win.h" |
22 #include "ui/views/ime/input_method_win.h" | 24 #include "ui/views/ime/input_method_win.h" |
23 #include "ui/views/widget/desktop_capture_client.h" | 25 #include "ui/views/widget/desktop_capture_client.h" |
24 #include "ui/views/widget/desktop_native_widget_aura.h" | 26 #include "ui/views/widget/desktop_native_widget_aura.h" |
25 #include "ui/views/widget/desktop_screen_position_client.h" | 27 #include "ui/views/widget/desktop_screen_position_client.h" |
26 #include "ui/views/widget/widget_delegate.h" | 28 #include "ui/views/widget/widget_delegate.h" |
27 #include "ui/views/widget/widget_hwnd_utils.h" | 29 #include "ui/views/widget/widget_hwnd_utils.h" |
28 #include "ui/views/win/fullscreen_handler.h" | 30 #include "ui/views/win/fullscreen_handler.h" |
29 #include "ui/views/win/hwnd_message_handler.h" | 31 #include "ui/views/win/hwnd_message_handler.h" |
30 #include "ui/views/window/native_frame_view.h" | 32 #include "ui/views/window/native_frame_view.h" |
31 | 33 |
32 namespace views { | 34 namespace views { |
33 | 35 |
34 DEFINE_WINDOW_PROPERTY_KEY( | 36 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); |
35 aura::Window*, kContentWindowForRootWindow, NULL); | |
36 | 37 |
37 //////////////////////////////////////////////////////////////////////////////// | 38 //////////////////////////////////////////////////////////////////////////////// |
38 // DesktopRootWindowHostWin, public: | 39 // DesktopRootWindowHostWin, public: |
39 | 40 |
40 DesktopRootWindowHostWin::DesktopRootWindowHostWin( | 41 DesktopRootWindowHostWin::DesktopRootWindowHostWin( |
41 internal::NativeWidgetDelegate* native_widget_delegate, | 42 internal::NativeWidgetDelegate* native_widget_delegate, |
42 DesktopNativeWidgetAura* desktop_native_widget_aura, | 43 DesktopNativeWidgetAura* desktop_native_widget_aura, |
43 const gfx::Rect& initial_bounds) | 44 const gfx::Rect& initial_bounds) |
44 : ALLOW_THIS_IN_INITIALIZER_LIST( | 45 : ALLOW_THIS_IN_INITIALIZER_LIST( |
45 message_handler_(new HWNDMessageHandler(this))), | 46 message_handler_(new HWNDMessageHandler(this))), |
46 native_widget_delegate_(native_widget_delegate), | 47 native_widget_delegate_(native_widget_delegate), |
47 desktop_native_widget_aura_(desktop_native_widget_aura), | 48 desktop_native_widget_aura_(desktop_native_widget_aura), |
48 root_window_host_delegate_(NULL), | 49 root_window_host_delegate_(NULL), |
49 content_window_(NULL) { | 50 content_window_(NULL) { |
50 } | 51 } |
51 | 52 |
52 DesktopRootWindowHostWin::~DesktopRootWindowHostWin() { | 53 DesktopRootWindowHostWin::~DesktopRootWindowHostWin() { |
53 } | 54 } |
54 | 55 |
55 // static | 56 // static |
56 aura::Window* DesktopRootWindowHostWin::GetContentWindowForHWND(HWND hwnd) { | 57 aura::Window* DesktopRootWindowHostWin::GetContentWindowForHWND(HWND hwnd) { |
57 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(hwnd); | 58 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(hwnd); |
58 return root ? root->GetProperty(kContentWindowForRootWindow) : NULL; | 59 return root ? root->GetProperty(kContentWindowForRootWindow) : NULL; |
59 } | 60 } |
60 | 61 |
| 62 // static |
| 63 ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { |
| 64 // Use NativeThemeWin for windows shown on the desktop, those not on the |
| 65 // desktop come from Ash and get NativeThemeAura. |
| 66 aura::RootWindow* root = window->GetRootWindow(); |
| 67 if (root) { |
| 68 HWND root_hwnd = root->GetAcceleratedWidget(); |
| 69 if (root_hwnd && |
| 70 DesktopRootWindowHostWin::GetContentWindowForHWND(root_hwnd)) { |
| 71 return ui::NativeThemeWin::instance(); |
| 72 } |
| 73 } |
| 74 return ui::NativeThemeAura::instance(); |
| 75 } |
| 76 |
61 //////////////////////////////////////////////////////////////////////////////// | 77 //////////////////////////////////////////////////////////////////////////////// |
62 // DesktopRootWindowHostWin, DesktopRootWindowHost implementation: | 78 // DesktopRootWindowHostWin, DesktopRootWindowHost implementation: |
63 | 79 |
64 aura::RootWindow* DesktopRootWindowHostWin::Init( | 80 aura::RootWindow* DesktopRootWindowHostWin::Init( |
65 aura::Window* content_window, | 81 aura::Window* content_window, |
66 const Widget::InitParams& params) { | 82 const Widget::InitParams& params) { |
67 // TODO(beng): SetInitParams(). | 83 // TODO(beng): SetInitParams(). |
68 content_window_ = content_window; | 84 content_window_ = content_window; |
69 | 85 |
70 ConfigureWindowStyles(message_handler_.get(), params, | 86 ConfigureWindowStyles(message_handler_.get(), params, |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 775 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
760 internal::NativeWidgetDelegate* native_widget_delegate, | 776 internal::NativeWidgetDelegate* native_widget_delegate, |
761 DesktopNativeWidgetAura* desktop_native_widget_aura, | 777 DesktopNativeWidgetAura* desktop_native_widget_aura, |
762 const gfx::Rect& initial_bounds) { | 778 const gfx::Rect& initial_bounds) { |
763 return new DesktopRootWindowHostWin(native_widget_delegate, | 779 return new DesktopRootWindowHostWin(native_widget_delegate, |
764 desktop_native_widget_aura, | 780 desktop_native_widget_aura, |
765 initial_bounds); | 781 initial_bounds); |
766 } | 782 } |
767 | 783 |
768 } // namespace views | 784 } // namespace views |
OLD | NEW |