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 "base/win/metro.h" | 7 #include "base/win/metro.h" |
8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // static | 72 // static |
73 aura::Window* DesktopRootWindowHostWin::GetContentWindowForHWND(HWND hwnd) { | 73 aura::Window* DesktopRootWindowHostWin::GetContentWindowForHWND(HWND hwnd) { |
74 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(hwnd); | 74 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(hwnd); |
75 return root ? root->GetProperty(kContentWindowForRootWindow) : NULL; | 75 return root ? root->GetProperty(kContentWindowForRootWindow) : NULL; |
76 } | 76 } |
77 | 77 |
78 // static | 78 // static |
79 ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { | 79 ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { |
80 // Use NativeThemeWin for windows shown on the desktop, those not on the | 80 // Use NativeThemeWin for windows shown on the desktop, those not on the |
81 // desktop come from Ash and get NativeThemeAura. | 81 // desktop come from Ash and get NativeThemeAura. |
82 aura::RootWindow* root = window ? window->GetRootWindow() : NULL; | 82 aura::WindowEventDispatcher* dispatcher = |
83 if (root) { | 83 window ? window->GetDispatcher() : NULL; |
84 HWND root_hwnd = root->GetAcceleratedWidget(); | 84 if (dispatcher) { |
85 if (root_hwnd && | 85 HWND host_hwnd = dispatcher->GetAcceleratedWidget(); |
86 DesktopRootWindowHostWin::GetContentWindowForHWND(root_hwnd)) { | 86 if (host_hwnd && |
| 87 DesktopRootWindowHostWin::GetContentWindowForHWND(host_hwnd)) { |
87 return ui::NativeThemeWin::instance(); | 88 return ui::NativeThemeWin::instance(); |
88 } | 89 } |
89 } | 90 } |
90 return ui::NativeThemeAura::instance(); | 91 return ui::NativeThemeAura::instance(); |
91 } | 92 } |
92 | 93 |
93 //////////////////////////////////////////////////////////////////////////////// | 94 //////////////////////////////////////////////////////////////////////////////// |
94 // DesktopRootWindowHostWin, DesktopRootWindowHost implementation: | 95 // DesktopRootWindowHostWin, DesktopRootWindowHost implementation: |
95 | 96 |
96 void DesktopRootWindowHostWin::Init( | 97 void DesktopRootWindowHostWin::Init( |
97 aura::Window* content_window, | 98 aura::Window* content_window, |
98 const Widget::InitParams& params, | 99 const Widget::InitParams& params, |
99 aura::RootWindow::CreateParams* rw_create_params) { | 100 aura::RootWindow::CreateParams* rw_create_params) { |
100 // TODO(beng): SetInitParams(). | 101 // TODO(beng): SetInitParams(). |
101 content_window_ = content_window; | 102 content_window_ = content_window; |
102 | 103 |
103 aura::client::SetAnimationHost(content_window_, this); | 104 aura::client::SetAnimationHost(content_window_, this); |
104 | 105 |
105 ConfigureWindowStyles(message_handler_.get(), params, | 106 ConfigureWindowStyles(message_handler_.get(), params, |
106 GetWidget()->widget_delegate(), | 107 GetWidget()->widget_delegate(), |
107 native_widget_delegate_); | 108 native_widget_delegate_); |
108 | 109 |
109 HWND parent_hwnd = NULL; | 110 HWND parent_hwnd = NULL; |
110 if (params.parent && params.parent->GetRootWindow()) | 111 if (params.parent && params.parent->GetDispatcher()) |
111 parent_hwnd = params.parent->GetRootWindow()->GetAcceleratedWidget(); | 112 parent_hwnd = params.parent->GetDispatcher()->GetAcceleratedWidget(); |
112 | 113 |
113 message_handler_->set_remove_standard_frame(params.remove_standard_frame); | 114 message_handler_->set_remove_standard_frame(params.remove_standard_frame); |
114 | 115 |
115 has_non_client_view_ = Widget::RequiresNonClientView(params.type); | 116 has_non_client_view_ = Widget::RequiresNonClientView(params.type); |
116 | 117 |
117 gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(params.bounds); | 118 gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(params.bounds); |
118 message_handler_->Init(parent_hwnd, pixel_bounds); | 119 message_handler_->Init(parent_hwnd, pixel_bounds); |
119 | 120 |
120 rw_create_params->host = this; | 121 rw_create_params->host = this; |
121 } | 122 } |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 | 876 |
876 // static | 877 // static |
877 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 878 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
878 internal::NativeWidgetDelegate* native_widget_delegate, | 879 internal::NativeWidgetDelegate* native_widget_delegate, |
879 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 880 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
880 return new DesktopRootWindowHostWin(native_widget_delegate, | 881 return new DesktopRootWindowHostWin(native_widget_delegate, |
881 desktop_native_widget_aura); | 882 desktop_native_widget_aura); |
882 } | 883 } |
883 | 884 |
884 } // namespace views | 885 } // namespace views |
OLD | NEW |