Chromium Code Reviews| Index: ui/views/widget/desktop_aura/desktop_root_window_host_ozone.cc |
| diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_ozone.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_ozone.cc |
| index ffca2a6337c55dfbd1ff0a8cf6dbc15ee9c76966..77382c83d118b637119b1d18d241d97034509f81 100644 |
| --- a/ui/views/widget/desktop_aura/desktop_root_window_host_ozone.cc |
| +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_ozone.cc |
| @@ -2,19 +2,359 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "ui/views/widget/desktop_aura/desktop_root_window_host_ozone.h" |
| + |
| +#include "ui/aura/client/drag_drop_client.h" |
| #include "ui/aura/window_tree_host.h" |
| +#include "ui/native_theme/native_theme.h" |
| +#include "ui/views/corewm/tooltip_aura.h" |
| +#include "ui/views/linux_ui/linux_ui.h" |
| #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" |
| #include "ui/views/widget/desktop_aura/desktop_factory_ozone.h" |
| namespace views { |
| -DesktopRootWindowHost* DesktopRootWindowHost::Create( |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// DesktopRootWindowHostOzone, public: |
| +DesktopRootWindowHostOzone::DesktopRootWindowHostOzone( |
| internal::NativeWidgetDelegate* native_widget_delegate, |
| DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| DesktopFactoryOzone* d_factory = DesktopFactoryOzone::GetInstance(); |
| - return d_factory->CreateRootWindowHost(native_widget_delegate, |
| - desktop_native_widget_aura); |
| + 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.
|
| + d_factory->CreateRootWindowHost( |
| + native_widget_delegate, |
| + desktop_native_widget_aura); |
| +} |
| + |
| +DesktopRootWindowHostOzone::~DesktopRootWindowHostOzone() { |
| +} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// DesktopRootWindowHostOzone, DesktopRootWindowHost implementation: |
| + |
| +void DesktopRootWindowHostOzone::Init( |
| + aura::Window* content_window, |
| + const Widget::InitParams& params, |
| + aura::RootWindow::CreateParams* rw_create_params) { |
| + drwh_ozone_->Init(content_window, params, rw_create_params); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::OnRootWindowCreated( |
| + aura::RootWindow* root, |
| + const Widget::InitParams& params) { |
| + drwh_ozone_->OnRootWindowCreated(root, params); |
| +} |
| + |
| +scoped_ptr<corewm::Tooltip> DesktopRootWindowHostOzone::CreateTooltip() { |
| + return drwh_ozone_->CreateTooltip(); |
| +} |
| + |
| +scoped_ptr<aura::client::DragDropClient> |
| +DesktopRootWindowHostOzone::CreateDragDropClient( |
| + DesktopNativeCursorManager* cursor_manager) { |
| + return drwh_ozone_->CreateDragDropClient(cursor_manager); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::Close() { |
| + drwh_ozone_->Close(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::CloseNow() { |
| + drwh_ozone_->CloseNow(); |
| +} |
| + |
| +aura::RootWindowHost* DesktopRootWindowHostOzone::AsRootWindowHost() { |
| + return drwh_ozone_->AsRootWindowHost(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::ShowWindowWithState( |
| + ui::WindowShowState show_state) { |
| + drwh_ozone_->ShowWindowWithState(show_state); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::ShowMaximizedWithBounds( |
| + const gfx::Rect& restored_bounds) { |
| + drwh_ozone_->ShowMaximizedWithBounds(restored_bounds); |
| +} |
| + |
| +bool DesktopRootWindowHostOzone::IsVisible() const { |
| + return drwh_ozone_->IsVisible(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::SetSize(const gfx::Size& size) { |
| + drwh_ozone_->SetSize(size); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::CenterWindow(const gfx::Size& size) { |
| + drwh_ozone_->CenterWindow(size); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::GetWindowPlacement( |
| + gfx::Rect* bounds, |
| + ui::WindowShowState* show_state) const { |
| + drwh_ozone_->GetWindowPlacement(bounds, show_state); |
| +} |
| + |
| +gfx::Rect DesktopRootWindowHostOzone::GetWindowBoundsInScreen() const { |
| + return drwh_ozone_->GetWindowBoundsInScreen(); |
| +} |
| + |
| +gfx::Rect DesktopRootWindowHostOzone::GetClientAreaBoundsInScreen() const { |
| + return drwh_ozone_->GetClientAreaBoundsInScreen(); |
| +} |
| + |
| +gfx::Rect DesktopRootWindowHostOzone::GetRestoredBounds() const { |
| + return drwh_ozone_->GetRestoredBounds(); |
| +} |
| + |
| +gfx::Rect DesktopRootWindowHostOzone::GetWorkAreaBoundsInScreen() const { |
| + return drwh_ozone_->GetWorkAreaBoundsInScreen(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::SetShape(gfx::NativeRegion native_region) { |
| + drwh_ozone_->SetShape(native_region); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::Activate() { |
| + drwh_ozone_->Activate(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::Deactivate() { |
| + drwh_ozone_->Deactivate(); |
| +} |
| + |
| +bool DesktopRootWindowHostOzone::IsActive() const { |
| + return drwh_ozone_->IsActive(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::Maximize() { |
| + drwh_ozone_->Maximize(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::Minimize() { |
| + drwh_ozone_->Minimize(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::Restore() { |
| + drwh_ozone_->Restore(); |
| +} |
| + |
| +bool DesktopRootWindowHostOzone::IsMaximized() const { |
| + return drwh_ozone_->IsMaximized(); |
| +} |
| + |
| +bool DesktopRootWindowHostOzone::IsMinimized() const { |
| + return drwh_ozone_->IsMinimized(); |
| +} |
| + |
| +bool DesktopRootWindowHostOzone::HasCapture() const { |
| + return drwh_ozone_->HasCapture(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::SetAlwaysOnTop(bool always_on_top) { |
| + drwh_ozone_->SetAlwaysOnTop(always_on_top); |
| +} |
| + |
| +bool DesktopRootWindowHostOzone::IsAlwaysOnTop() const { |
| + return drwh_ozone_->IsAlwaysOnTop(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::SetWindowTitle(const string16& title) { |
| + drwh_ozone_->SetWindowTitle(title); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::ClearNativeFocus() { |
| + drwh_ozone_->ClearNativeFocus(); |
| +} |
| + |
| +Widget::MoveLoopResult DesktopRootWindowHostOzone::RunMoveLoop( |
| + const gfx::Vector2d& drag_offset, |
| + Widget::MoveLoopSource source, |
| + Widget::MoveLoopEscapeBehavior escape_behavior) { |
| + return drwh_ozone_->RunMoveLoop(drag_offset, source, escape_behavior); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::EndMoveLoop() { |
| + drwh_ozone_->EndMoveLoop(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::SetVisibilityChangedAnimationsEnabled( |
| + bool value) { |
| + drwh_ozone_->SetVisibilityChangedAnimationsEnabled(value); |
| +} |
| + |
| +bool DesktopRootWindowHostOzone::ShouldUseNativeFrame() { |
| + return drwh_ozone_->ShouldUseNativeFrame(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::FrameTypeChanged() { |
| + drwh_ozone_->FrameTypeChanged(); |
| +} |
| + |
| +NonClientFrameView* DesktopRootWindowHostOzone::CreateNonClientFrameView() { |
| + return drwh_ozone_->CreateNonClientFrameView(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::SetFullscreen(bool fullscreen) { |
| + drwh_ozone_->SetFullscreen(fullscreen); |
| +} |
| + |
| +bool DesktopRootWindowHostOzone::IsFullscreen() const { |
| + return drwh_ozone_->IsFullscreen(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::SetOpacity(unsigned char opacity) { |
| + drwh_ozone_->SetOpacity(opacity); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::SetWindowIcons( |
| + const gfx::ImageSkia& window_icon, const gfx::ImageSkia& app_icon) { |
| + drwh_ozone_->SetWindowIcons(window_icon, app_icon); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::InitModalType(ui::ModalType modal_type) { |
| + drwh_ozone_->InitModalType(modal_type); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::FlashFrame(bool flash_frame) { |
| + drwh_ozone_->FlashFrame(flash_frame); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::OnRootViewLayout() const { |
| + drwh_ozone_->OnRootViewLayout(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::OnNativeWidgetFocus() { |
| + drwh_ozone_->OnNativeWidgetFocus(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::OnNativeWidgetBlur() { |
| + drwh_ozone_->OnNativeWidgetBlur(); |
| +} |
| + |
| +bool DesktopRootWindowHostOzone::IsAnimatingClosed() const { |
| + return drwh_ozone_->IsAnimatingClosed(); |
| +} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// DesktopRootWindowHostOzone, aura::RootWindowHost implementation: |
| + |
| +aura::RootWindow* DesktopRootWindowHostOzone::GetRootWindow() { |
| + return drwh_ozone_->GetRootWindow(); |
| +} |
| + |
| +gfx::AcceleratedWidget DesktopRootWindowHostOzone::GetAcceleratedWidget() { |
| + return drwh_ozone_->GetAcceleratedWidget(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::Show() { |
| + drwh_ozone_->Show(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::Hide() { |
| + drwh_ozone_->Hide(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::ToggleFullScreen() { |
| + drwh_ozone_->ToggleFullScreen(); |
| +} |
| + |
| +gfx::Rect DesktopRootWindowHostOzone::GetBounds() const { |
| + return drwh_ozone_->GetBounds(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::SetBounds(const gfx::Rect& bounds) { |
| + drwh_ozone_->SetBounds(bounds); |
| +} |
| + |
| +gfx::Insets DesktopRootWindowHostOzone::GetInsets() const { |
| + return drwh_ozone_->GetInsets(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::SetInsets(const gfx::Insets& insets) { |
| + drwh_ozone_->SetInsets(insets); |
| +} |
| + |
| +gfx::Point DesktopRootWindowHostOzone::GetLocationOnNativeScreen() const { |
| + return drwh_ozone_->GetLocationOnNativeScreen(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::SetCapture() { |
| + drwh_ozone_->SetCapture(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::ReleaseCapture() { |
| + drwh_ozone_->ReleaseCapture(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::SetCursor(gfx::NativeCursor cursor) { |
| + drwh_ozone_->SetCursor(cursor); |
| +} |
| + |
| +bool DesktopRootWindowHostOzone::QueryMouseLocation( |
| + gfx::Point* location_return) { |
| + return drwh_ozone_->QueryMouseLocation(location_return); |
| +} |
| + |
| +bool DesktopRootWindowHostOzone::ConfineCursorToRootWindow() { |
| + return drwh_ozone_->ConfineCursorToRootWindow(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::UnConfineCursor() { |
| + drwh_ozone_->UnConfineCursor(); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::OnCursorVisibilityChanged(bool show) { |
| + drwh_ozone_->OnCursorVisibilityChanged(show); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::MoveCursorTo(const gfx::Point& location) { |
| + drwh_ozone_->MoveCursorTo(location); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::PostNativeEvent( |
| + const base::NativeEvent& native_event) { |
| + drwh_ozone_->PostNativeEvent(native_event); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::OnDeviceScaleFactorChanged( |
| + float device_scale_factor) { |
| + drwh_ozone_->OnDeviceScaleFactorChanged(device_scale_factor); |
| +} |
| + |
| +void DesktopRootWindowHostOzone::PrepareForShutdown() { |
| + drwh_ozone_->PrepareForShutdown(); |
| +} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// DesktopRootWindowHostOzone, MessageLoop::Dispatcher implementation: |
| + |
| +bool DesktopRootWindowHostOzone::Dispatch(const base::NativeEvent& ne) { |
| + return drwh_ozone_->Dispatch(ne); |
| +} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// DesktopRootWindowHost, public: |
| + |
| +// static |
| +DesktopRootWindowHost* DesktopRootWindowHost::Create( |
| + internal::NativeWidgetDelegate* native_widget_delegate, |
| + DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| + return new DesktopRootWindowHostOzone(native_widget_delegate, |
| + desktop_native_widget_aura); |
| +} |
| + |
| +// static |
| +ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { |
| + const views::LinuxUI* linux_ui = views::LinuxUI::instance(); |
| + if (linux_ui) { |
| + ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); |
| + if (native_theme) |
| + return native_theme; |
| + } |
| + |
| + return ui::NativeTheme::instance(); |
| } |
| } // namespace views |