Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ozone.h" | |
| 6 | |
| 7 #include "ui/aura/client/drag_drop_client.h" | |
| 5 #include "ui/aura/window_tree_host.h" | 8 #include "ui/aura/window_tree_host.h" |
| 9 #include "ui/native_theme/native_theme.h" | |
| 10 #include "ui/views/corewm/tooltip_aura.h" | |
| 11 #include "ui/views/linux_ui/linux_ui.h" | |
| 6 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" | 12 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" |
| 7 #include "ui/views/widget/desktop_aura/desktop_factory_ozone.h" | 13 #include "ui/views/widget/desktop_aura/desktop_factory_ozone.h" |
| 8 | 14 |
| 9 namespace views { | 15 namespace views { |
| 10 | 16 |
| 17 //////////////////////////////////////////////////////////////////////////////// | |
| 18 // DesktopRootWindowHostOzone, public: | |
| 19 DesktopRootWindowHostOzone::DesktopRootWindowHostOzone( | |
| 20 internal::NativeWidgetDelegate* native_widget_delegate, | |
| 21 DesktopNativeWidgetAura* desktop_native_widget_aura) { | |
| 22 DesktopFactoryOzone* d_factory = DesktopFactoryOzone::GetInstance(); | |
| 23 | |
| 24 drwh_ozone_ = (DesktopRootWindowHostOzone *) | |
|
Elliot Glaysher
2013/11/22 21:19:38
Why are you doing this cast? The interface returns
vignatti (out of this project)
2013/11/25 20:41:30
yup, I'm fixing it next.
| |
| 25 d_factory->CreateRootWindowHost( | |
| 26 native_widget_delegate, | |
| 27 desktop_native_widget_aura); | |
| 28 } | |
| 29 | |
| 30 DesktopRootWindowHostOzone::~DesktopRootWindowHostOzone() { | |
| 31 } | |
| 32 | |
| 33 //////////////////////////////////////////////////////////////////////////////// | |
| 34 // DesktopRootWindowHostOzone, DesktopRootWindowHost implementation: | |
| 35 | |
| 36 void DesktopRootWindowHostOzone::Init( | |
| 37 aura::Window* content_window, | |
| 38 const Widget::InitParams& params, | |
| 39 aura::RootWindow::CreateParams* rw_create_params) { | |
| 40 drwh_ozone_->Init(content_window, params, rw_create_params); | |
| 41 } | |
| 42 | |
| 43 void DesktopRootWindowHostOzone::OnRootWindowCreated( | |
| 44 aura::RootWindow* root, | |
| 45 const Widget::InitParams& params) { | |
| 46 drwh_ozone_->OnRootWindowCreated(root, params); | |
| 47 } | |
| 48 | |
| 49 scoped_ptr<corewm::Tooltip> DesktopRootWindowHostOzone::CreateTooltip() { | |
| 50 return drwh_ozone_->CreateTooltip(); | |
| 51 } | |
| 52 | |
| 53 scoped_ptr<aura::client::DragDropClient> | |
| 54 DesktopRootWindowHostOzone::CreateDragDropClient( | |
| 55 DesktopNativeCursorManager* cursor_manager) { | |
| 56 return drwh_ozone_->CreateDragDropClient(cursor_manager); | |
| 57 } | |
| 58 | |
| 59 void DesktopRootWindowHostOzone::Close() { | |
| 60 drwh_ozone_->Close(); | |
| 61 } | |
| 62 | |
| 63 void DesktopRootWindowHostOzone::CloseNow() { | |
| 64 drwh_ozone_->CloseNow(); | |
| 65 } | |
| 66 | |
| 67 aura::RootWindowHost* DesktopRootWindowHostOzone::AsRootWindowHost() { | |
| 68 return drwh_ozone_->AsRootWindowHost(); | |
| 69 } | |
| 70 | |
| 71 void DesktopRootWindowHostOzone::ShowWindowWithState( | |
| 72 ui::WindowShowState show_state) { | |
| 73 drwh_ozone_->ShowWindowWithState(show_state); | |
| 74 } | |
| 75 | |
| 76 void DesktopRootWindowHostOzone::ShowMaximizedWithBounds( | |
| 77 const gfx::Rect& restored_bounds) { | |
| 78 drwh_ozone_->ShowMaximizedWithBounds(restored_bounds); | |
| 79 } | |
| 80 | |
| 81 bool DesktopRootWindowHostOzone::IsVisible() const { | |
| 82 return drwh_ozone_->IsVisible(); | |
| 83 } | |
| 84 | |
| 85 void DesktopRootWindowHostOzone::SetSize(const gfx::Size& size) { | |
| 86 drwh_ozone_->SetSize(size); | |
| 87 } | |
| 88 | |
| 89 void DesktopRootWindowHostOzone::CenterWindow(const gfx::Size& size) { | |
| 90 drwh_ozone_->CenterWindow(size); | |
| 91 } | |
| 92 | |
| 93 void DesktopRootWindowHostOzone::GetWindowPlacement( | |
| 94 gfx::Rect* bounds, | |
| 95 ui::WindowShowState* show_state) const { | |
| 96 drwh_ozone_->GetWindowPlacement(bounds, show_state); | |
| 97 } | |
| 98 | |
| 99 gfx::Rect DesktopRootWindowHostOzone::GetWindowBoundsInScreen() const { | |
| 100 return drwh_ozone_->GetWindowBoundsInScreen(); | |
| 101 } | |
| 102 | |
| 103 gfx::Rect DesktopRootWindowHostOzone::GetClientAreaBoundsInScreen() const { | |
| 104 return drwh_ozone_->GetClientAreaBoundsInScreen(); | |
| 105 } | |
| 106 | |
| 107 gfx::Rect DesktopRootWindowHostOzone::GetRestoredBounds() const { | |
| 108 return drwh_ozone_->GetRestoredBounds(); | |
| 109 } | |
| 110 | |
| 111 gfx::Rect DesktopRootWindowHostOzone::GetWorkAreaBoundsInScreen() const { | |
| 112 return drwh_ozone_->GetWorkAreaBoundsInScreen(); | |
| 113 } | |
| 114 | |
| 115 void DesktopRootWindowHostOzone::SetShape(gfx::NativeRegion native_region) { | |
| 116 drwh_ozone_->SetShape(native_region); | |
| 117 } | |
| 118 | |
| 119 void DesktopRootWindowHostOzone::Activate() { | |
| 120 drwh_ozone_->Activate(); | |
| 121 } | |
| 122 | |
| 123 void DesktopRootWindowHostOzone::Deactivate() { | |
| 124 drwh_ozone_->Deactivate(); | |
| 125 } | |
| 126 | |
| 127 bool DesktopRootWindowHostOzone::IsActive() const { | |
| 128 return drwh_ozone_->IsActive(); | |
| 129 } | |
| 130 | |
| 131 void DesktopRootWindowHostOzone::Maximize() { | |
| 132 drwh_ozone_->Maximize(); | |
| 133 } | |
| 134 | |
| 135 void DesktopRootWindowHostOzone::Minimize() { | |
| 136 drwh_ozone_->Minimize(); | |
| 137 } | |
| 138 | |
| 139 void DesktopRootWindowHostOzone::Restore() { | |
| 140 drwh_ozone_->Restore(); | |
| 141 } | |
| 142 | |
| 143 bool DesktopRootWindowHostOzone::IsMaximized() const { | |
| 144 return drwh_ozone_->IsMaximized(); | |
| 145 } | |
| 146 | |
| 147 bool DesktopRootWindowHostOzone::IsMinimized() const { | |
| 148 return drwh_ozone_->IsMinimized(); | |
| 149 } | |
| 150 | |
| 151 bool DesktopRootWindowHostOzone::HasCapture() const { | |
| 152 return drwh_ozone_->HasCapture(); | |
| 153 } | |
| 154 | |
| 155 void DesktopRootWindowHostOzone::SetAlwaysOnTop(bool always_on_top) { | |
| 156 drwh_ozone_->SetAlwaysOnTop(always_on_top); | |
| 157 } | |
| 158 | |
| 159 bool DesktopRootWindowHostOzone::IsAlwaysOnTop() const { | |
| 160 return drwh_ozone_->IsAlwaysOnTop(); | |
| 161 } | |
| 162 | |
| 163 void DesktopRootWindowHostOzone::SetWindowTitle(const string16& title) { | |
| 164 drwh_ozone_->SetWindowTitle(title); | |
| 165 } | |
| 166 | |
| 167 void DesktopRootWindowHostOzone::ClearNativeFocus() { | |
| 168 drwh_ozone_->ClearNativeFocus(); | |
| 169 } | |
| 170 | |
| 171 Widget::MoveLoopResult DesktopRootWindowHostOzone::RunMoveLoop( | |
| 172 const gfx::Vector2d& drag_offset, | |
| 173 Widget::MoveLoopSource source, | |
| 174 Widget::MoveLoopEscapeBehavior escape_behavior) { | |
| 175 return drwh_ozone_->RunMoveLoop(drag_offset, source, escape_behavior); | |
| 176 } | |
| 177 | |
| 178 void DesktopRootWindowHostOzone::EndMoveLoop() { | |
| 179 drwh_ozone_->EndMoveLoop(); | |
| 180 } | |
| 181 | |
| 182 void DesktopRootWindowHostOzone::SetVisibilityChangedAnimationsEnabled( | |
| 183 bool value) { | |
| 184 drwh_ozone_->SetVisibilityChangedAnimationsEnabled(value); | |
| 185 } | |
| 186 | |
| 187 bool DesktopRootWindowHostOzone::ShouldUseNativeFrame() { | |
| 188 return drwh_ozone_->ShouldUseNativeFrame(); | |
| 189 } | |
| 190 | |
| 191 void DesktopRootWindowHostOzone::FrameTypeChanged() { | |
| 192 drwh_ozone_->FrameTypeChanged(); | |
| 193 } | |
| 194 | |
| 195 NonClientFrameView* DesktopRootWindowHostOzone::CreateNonClientFrameView() { | |
| 196 return drwh_ozone_->CreateNonClientFrameView(); | |
| 197 } | |
| 198 | |
| 199 void DesktopRootWindowHostOzone::SetFullscreen(bool fullscreen) { | |
| 200 drwh_ozone_->SetFullscreen(fullscreen); | |
| 201 } | |
| 202 | |
| 203 bool DesktopRootWindowHostOzone::IsFullscreen() const { | |
| 204 return drwh_ozone_->IsFullscreen(); | |
| 205 } | |
| 206 | |
| 207 void DesktopRootWindowHostOzone::SetOpacity(unsigned char opacity) { | |
| 208 drwh_ozone_->SetOpacity(opacity); | |
| 209 } | |
| 210 | |
| 211 void DesktopRootWindowHostOzone::SetWindowIcons( | |
| 212 const gfx::ImageSkia& window_icon, const gfx::ImageSkia& app_icon) { | |
| 213 drwh_ozone_->SetWindowIcons(window_icon, app_icon); | |
| 214 } | |
| 215 | |
| 216 void DesktopRootWindowHostOzone::InitModalType(ui::ModalType modal_type) { | |
| 217 drwh_ozone_->InitModalType(modal_type); | |
| 218 } | |
| 219 | |
| 220 void DesktopRootWindowHostOzone::FlashFrame(bool flash_frame) { | |
| 221 drwh_ozone_->FlashFrame(flash_frame); | |
| 222 } | |
| 223 | |
| 224 void DesktopRootWindowHostOzone::OnRootViewLayout() const { | |
| 225 drwh_ozone_->OnRootViewLayout(); | |
| 226 } | |
| 227 | |
| 228 void DesktopRootWindowHostOzone::OnNativeWidgetFocus() { | |
| 229 drwh_ozone_->OnNativeWidgetFocus(); | |
| 230 } | |
| 231 | |
| 232 void DesktopRootWindowHostOzone::OnNativeWidgetBlur() { | |
| 233 drwh_ozone_->OnNativeWidgetBlur(); | |
| 234 } | |
| 235 | |
| 236 bool DesktopRootWindowHostOzone::IsAnimatingClosed() const { | |
| 237 return drwh_ozone_->IsAnimatingClosed(); | |
| 238 } | |
| 239 | |
| 240 //////////////////////////////////////////////////////////////////////////////// | |
| 241 // DesktopRootWindowHostOzone, aura::RootWindowHost implementation: | |
| 242 | |
| 243 aura::RootWindow* DesktopRootWindowHostOzone::GetRootWindow() { | |
| 244 return drwh_ozone_->GetRootWindow(); | |
| 245 } | |
| 246 | |
| 247 gfx::AcceleratedWidget DesktopRootWindowHostOzone::GetAcceleratedWidget() { | |
| 248 return drwh_ozone_->GetAcceleratedWidget(); | |
| 249 } | |
| 250 | |
| 251 void DesktopRootWindowHostOzone::Show() { | |
| 252 drwh_ozone_->Show(); | |
| 253 } | |
| 254 | |
| 255 void DesktopRootWindowHostOzone::Hide() { | |
| 256 drwh_ozone_->Hide(); | |
| 257 } | |
| 258 | |
| 259 void DesktopRootWindowHostOzone::ToggleFullScreen() { | |
| 260 drwh_ozone_->ToggleFullScreen(); | |
| 261 } | |
| 262 | |
| 263 gfx::Rect DesktopRootWindowHostOzone::GetBounds() const { | |
| 264 return drwh_ozone_->GetBounds(); | |
| 265 } | |
| 266 | |
| 267 void DesktopRootWindowHostOzone::SetBounds(const gfx::Rect& bounds) { | |
| 268 drwh_ozone_->SetBounds(bounds); | |
| 269 } | |
| 270 | |
| 271 gfx::Insets DesktopRootWindowHostOzone::GetInsets() const { | |
| 272 return drwh_ozone_->GetInsets(); | |
| 273 } | |
| 274 | |
| 275 void DesktopRootWindowHostOzone::SetInsets(const gfx::Insets& insets) { | |
| 276 drwh_ozone_->SetInsets(insets); | |
| 277 } | |
| 278 | |
| 279 gfx::Point DesktopRootWindowHostOzone::GetLocationOnNativeScreen() const { | |
| 280 return drwh_ozone_->GetLocationOnNativeScreen(); | |
| 281 } | |
| 282 | |
| 283 void DesktopRootWindowHostOzone::SetCapture() { | |
| 284 drwh_ozone_->SetCapture(); | |
| 285 } | |
| 286 | |
| 287 void DesktopRootWindowHostOzone::ReleaseCapture() { | |
| 288 drwh_ozone_->ReleaseCapture(); | |
| 289 } | |
| 290 | |
| 291 void DesktopRootWindowHostOzone::SetCursor(gfx::NativeCursor cursor) { | |
| 292 drwh_ozone_->SetCursor(cursor); | |
| 293 } | |
| 294 | |
| 295 bool DesktopRootWindowHostOzone::QueryMouseLocation( | |
| 296 gfx::Point* location_return) { | |
| 297 return drwh_ozone_->QueryMouseLocation(location_return); | |
| 298 } | |
| 299 | |
| 300 bool DesktopRootWindowHostOzone::ConfineCursorToRootWindow() { | |
| 301 return drwh_ozone_->ConfineCursorToRootWindow(); | |
| 302 } | |
| 303 | |
| 304 void DesktopRootWindowHostOzone::UnConfineCursor() { | |
| 305 drwh_ozone_->UnConfineCursor(); | |
| 306 } | |
| 307 | |
| 308 void DesktopRootWindowHostOzone::OnCursorVisibilityChanged(bool show) { | |
| 309 drwh_ozone_->OnCursorVisibilityChanged(show); | |
| 310 } | |
| 311 | |
| 312 void DesktopRootWindowHostOzone::MoveCursorTo(const gfx::Point& location) { | |
| 313 drwh_ozone_->MoveCursorTo(location); | |
| 314 } | |
| 315 | |
| 316 void DesktopRootWindowHostOzone::PostNativeEvent( | |
| 317 const base::NativeEvent& native_event) { | |
| 318 drwh_ozone_->PostNativeEvent(native_event); | |
| 319 } | |
| 320 | |
| 321 void DesktopRootWindowHostOzone::OnDeviceScaleFactorChanged( | |
| 322 float device_scale_factor) { | |
| 323 drwh_ozone_->OnDeviceScaleFactorChanged(device_scale_factor); | |
| 324 } | |
| 325 | |
| 326 void DesktopRootWindowHostOzone::PrepareForShutdown() { | |
| 327 drwh_ozone_->PrepareForShutdown(); | |
| 328 } | |
| 329 | |
| 330 //////////////////////////////////////////////////////////////////////////////// | |
| 331 // DesktopRootWindowHostOzone, MessageLoop::Dispatcher implementation: | |
| 332 | |
| 333 bool DesktopRootWindowHostOzone::Dispatch(const base::NativeEvent& ne) { | |
| 334 return drwh_ozone_->Dispatch(ne); | |
| 335 } | |
| 336 | |
| 337 //////////////////////////////////////////////////////////////////////////////// | |
| 338 // DesktopRootWindowHost, public: | |
| 339 | |
| 340 // static | |
| 11 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 341 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
| 12 internal::NativeWidgetDelegate* native_widget_delegate, | 342 internal::NativeWidgetDelegate* native_widget_delegate, |
| 13 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 343 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| 14 DesktopFactoryOzone* d_factory = DesktopFactoryOzone::GetInstance(); | 344 return new DesktopRootWindowHostOzone(native_widget_delegate, |
| 15 | 345 desktop_native_widget_aura); |
| 16 return d_factory->CreateRootWindowHost(native_widget_delegate, | 346 } |
| 17 desktop_native_widget_aura); | 347 |
| 348 // static | |
| 349 ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { | |
| 350 const views::LinuxUI* linux_ui = views::LinuxUI::instance(); | |
| 351 if (linux_ui) { | |
| 352 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); | |
| 353 if (native_theme) | |
| 354 return native_theme; | |
| 355 } | |
| 356 | |
| 357 return ui::NativeTheme::instance(); | |
| 18 } | 358 } |
| 19 | 359 |
| 20 } // namespace views | 360 } // namespace views |
| OLD | NEW |