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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_H_
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/aura/root_window.h"
10 #include "ui/base/ui_base_types.h"
11 #include "ui/views/views_export.h"
12 #include "ui/views/widget/widget.h"
39 class NativeWidgetDelegate;
42 class DesktopNativeCursorManager;
43 class DesktopNativeWidgetAura;
45 class VIEWS_EXPORT DesktopRootWindowHost {
47 virtual ~DesktopRootWindowHost() {}
49 static DesktopRootWindowHost* Create(
50 internal::NativeWidgetDelegate* native_widget_delegate,
51 DesktopNativeWidgetAura* desktop_native_widget_aura);
53 // Return the NativeTheme to use for |window|. WARNING: |window| may be NULL.
54 static ui::NativeTheme* GetNativeTheme(aura::Window* window);
56 // Sets up resources needed before the RootWindow has been created.
57 virtual void Init(aura::Window* content_window,
58 const Widget::InitParams& params,
59 aura::RootWindow::CreateParams* rw_create_params) = 0;
61 // Invoked once the RootWindow has been created. Caller owns the RootWindow.
62 virtual void OnRootWindowCreated(aura::RootWindow* root,
63 const Widget::InitParams& params) = 0;
65 // Creates and returns the Tooltip implementation to use. Return value is
66 // owned by DesktopNativeWidgetAura and lives as long as
67 // DesktopRootWindowHost.
68 virtual scoped_ptr<corewm::Tooltip> CreateTooltip() = 0;
70 // Creates and returns the DragDropClient implementation to use. Return value
71 // is owned by DesktopNativeWidgetAura and lives as long as
72 // DesktopRootWindowHost.
73 virtual scoped_ptr<aura::client::DragDropClient> CreateDragDropClient(
74 DesktopNativeCursorManager* cursor_manager) = 0;
76 virtual void Close() = 0;
77 virtual void CloseNow() = 0;
79 virtual aura::RootWindowHost* AsRootWindowHost() = 0;
81 virtual void ShowWindowWithState(ui::WindowShowState show_state) = 0;
82 virtual void ShowMaximizedWithBounds(const gfx::Rect& restored_bounds) = 0;
84 virtual bool IsVisible() const = 0;
86 virtual void SetSize(const gfx::Size& size) = 0;
87 virtual void CenterWindow(const gfx::Size& size) = 0;
88 virtual void GetWindowPlacement(gfx::Rect* bounds,
89 ui::WindowShowState* show_state) const = 0;
90 virtual gfx::Rect GetWindowBoundsInScreen() const = 0;
91 virtual gfx::Rect GetClientAreaBoundsInScreen() const = 0;
92 virtual gfx::Rect GetRestoredBounds() const = 0;
94 virtual gfx::Rect GetWorkAreaBoundsInScreen() const = 0;
96 // Sets the shape of the root window. If |native_region| is NULL then the
97 // window reverts to rectangular. Takes ownership of |native_region|.
98 virtual void SetShape(gfx::NativeRegion native_region) = 0;
100 virtual void Activate() = 0;
101 virtual void Deactivate() = 0;
102 virtual bool IsActive() const = 0;
103 virtual void Maximize() = 0;
104 virtual void Minimize() = 0;
105 virtual void Restore() = 0;
106 virtual bool IsMaximized() const = 0;
107 virtual bool IsMinimized() const = 0;
109 virtual bool HasCapture() const = 0;
111 virtual void SetAlwaysOnTop(bool always_on_top) = 0;
112 virtual bool IsAlwaysOnTop() const = 0;
114 virtual void SetWindowTitle(const string16& title) = 0;
116 virtual void ClearNativeFocus() = 0;
118 virtual Widget::MoveLoopResult RunMoveLoop(
119 const gfx::Vector2d& drag_offset,
120 Widget::MoveLoopSource source,
121 Widget::MoveLoopEscapeBehavior escape_behavior) = 0;
122 virtual void EndMoveLoop() = 0;
124 virtual void SetVisibilityChangedAnimationsEnabled(bool value) = 0;
126 virtual bool ShouldUseNativeFrame() = 0;
127 virtual void FrameTypeChanged() = 0;
128 virtual NonClientFrameView* CreateNonClientFrameView() = 0;
130 virtual void SetFullscreen(bool fullscreen) = 0;
131 virtual bool IsFullscreen() const = 0;
133 virtual void SetOpacity(unsigned char opacity) = 0;
135 virtual void SetWindowIcons(const gfx::ImageSkia& window_icon,
136 const gfx::ImageSkia& app_icon) = 0;
138 virtual void InitModalType(ui::ModalType modal_type) = 0;
140 virtual void FlashFrame(bool flash_frame) = 0;
142 virtual void OnRootViewLayout() const = 0;
144 // Called when the DesktopNativeWidgetAura's aura::Window is focused and
146 virtual void OnNativeWidgetFocus() = 0;
147 virtual void OnNativeWidgetBlur() = 0;
149 // Returns true if the Widget was closed but is still showing because of
151 virtual bool IsAnimatingClosed() const = 0;
156 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_H_