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_WINDOW_TREE_HOST_H_
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/aura/window_event_dispatcher.h"
10 #include "ui/base/ui_base_types.h"
11 #include "ui/views/views_export.h"
12 #include "ui/views/widget/widget.h"
38 class NativeWidgetDelegate
;
41 class DesktopNativeCursorManager
;
42 class DesktopNativeWidgetAura
;
44 class VIEWS_EXPORT DesktopWindowTreeHost
{
46 virtual ~DesktopWindowTreeHost() {}
48 static DesktopWindowTreeHost
* Create(
49 internal::NativeWidgetDelegate
* native_widget_delegate
,
50 DesktopNativeWidgetAura
* desktop_native_widget_aura
);
52 // Return the NativeTheme to use for |window|. WARNING: |window| may be NULL.
53 static ui::NativeTheme
* GetNativeTheme(aura::Window
* window
);
55 // Sets up resources needed before the WindowEventDispatcher has been created.
56 virtual void Init(aura::Window
* content_window
,
57 const Widget::InitParams
& params
) = 0;
59 // Invoked once the DesktopNativeWidgetAura has been created.
60 virtual void OnNativeWidgetCreated(const Widget::InitParams
& params
) = 0;
62 // Creates and returns the Tooltip implementation to use. Return value is
63 // owned by DesktopNativeWidgetAura and lives as long as
64 // DesktopWindowTreeHost.
65 virtual scoped_ptr
<corewm::Tooltip
> CreateTooltip() = 0;
67 // Creates and returns the DragDropClient implementation to use. Return value
68 // is owned by DesktopNativeWidgetAura and lives as long as
69 // DesktopWindowTreeHost.
70 virtual scoped_ptr
<aura::client::DragDropClient
> CreateDragDropClient(
71 DesktopNativeCursorManager
* cursor_manager
) = 0;
73 virtual void Close() = 0;
74 virtual void CloseNow() = 0;
76 virtual aura::WindowTreeHost
* AsWindowTreeHost() = 0;
78 virtual void ShowWindowWithState(ui::WindowShowState show_state
) = 0;
79 virtual void ShowMaximizedWithBounds(const gfx::Rect
& restored_bounds
) = 0;
81 virtual bool IsVisible() const = 0;
83 virtual void SetSize(const gfx::Size
& size
) = 0;
84 virtual void StackAbove(aura::Window
* window
) = 0;
85 virtual void StackAtTop() = 0;
86 virtual void CenterWindow(const gfx::Size
& size
) = 0;
87 virtual void GetWindowPlacement(gfx::Rect
* bounds
,
88 ui::WindowShowState
* show_state
) const = 0;
89 virtual gfx::Rect
GetWindowBoundsInScreen() const = 0;
90 virtual gfx::Rect
GetClientAreaBoundsInScreen() const = 0;
91 virtual gfx::Rect
GetRestoredBounds() const = 0;
93 virtual gfx::Rect
GetWorkAreaBoundsInScreen() const = 0;
95 // Sets the shape of the root window. If |native_region| is NULL then the
96 // window reverts to rectangular. Takes ownership of |native_region|.
97 virtual void SetShape(SkRegion
* native_region
) = 0;
99 virtual void Activate() = 0;
100 virtual void Deactivate() = 0;
101 virtual bool IsActive() const = 0;
102 virtual void Maximize() = 0;
103 virtual void Minimize() = 0;
104 virtual void Restore() = 0;
105 virtual bool IsMaximized() const = 0;
106 virtual bool IsMinimized() const = 0;
108 virtual bool HasCapture() const = 0;
110 virtual void SetAlwaysOnTop(bool always_on_top
) = 0;
111 virtual bool IsAlwaysOnTop() const = 0;
113 virtual void SetVisibleOnAllWorkspaces(bool always_visible
) = 0;
115 // Returns true if the title changed.
116 virtual bool SetWindowTitle(const base::string16
& title
) = 0;
118 virtual void ClearNativeFocus() = 0;
120 virtual Widget::MoveLoopResult
RunMoveLoop(
121 const gfx::Vector2d
& drag_offset
,
122 Widget::MoveLoopSource source
,
123 Widget::MoveLoopEscapeBehavior escape_behavior
) = 0;
124 virtual void EndMoveLoop() = 0;
126 virtual void SetVisibilityChangedAnimationsEnabled(bool value
) = 0;
128 // Determines whether the window should use native title bar and borders.
129 virtual bool ShouldUseNativeFrame() const = 0;
130 // Determines whether the window contents should be rendered transparently
131 // (for example, so that they can overhang onto the window title bar).
132 virtual bool ShouldWindowContentsBeTransparent() const = 0;
133 virtual void FrameTypeChanged() = 0;
135 virtual void SetFullscreen(bool fullscreen
) = 0;
136 virtual bool IsFullscreen() const = 0;
138 virtual void SetOpacity(unsigned char opacity
) = 0;
140 virtual void SetWindowIcons(const gfx::ImageSkia
& window_icon
,
141 const gfx::ImageSkia
& app_icon
) = 0;
143 virtual void InitModalType(ui::ModalType modal_type
) = 0;
145 virtual void FlashFrame(bool flash_frame
) = 0;
147 virtual void OnRootViewLayout() = 0;
149 // Called when the DesktopNativeWidgetAura's aura::Window is focused and
151 virtual void OnNativeWidgetFocus() = 0;
152 virtual void OnNativeWidgetBlur() = 0;
154 // Returns true if the Widget was closed but is still showing because of
156 virtual bool IsAnimatingClosed() const = 0;
158 // Returns true if the Widget supports translucency.
159 virtual bool IsTranslucentWindowOpacitySupported() const = 0;
161 // Called when the window's size constraints change.
162 virtual void SizeConstraintsChanged() = 0;
167 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_H_