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 StackAtTop() = 0;
85 virtual void CenterWindow(const gfx::Size
& size
) = 0;
86 virtual void GetWindowPlacement(gfx::Rect
* bounds
,
87 ui::WindowShowState
* show_state
) const = 0;
88 virtual gfx::Rect
GetWindowBoundsInScreen() const = 0;
89 virtual gfx::Rect
GetClientAreaBoundsInScreen() const = 0;
90 virtual gfx::Rect
GetRestoredBounds() const = 0;
92 virtual gfx::Rect
GetWorkAreaBoundsInScreen() const = 0;
94 // Sets the shape of the root window. If |native_region| is NULL then the
95 // window reverts to rectangular. Takes ownership of |native_region|.
96 virtual void SetShape(gfx::NativeRegion native_region
) = 0;
98 virtual void Activate() = 0;
99 virtual void Deactivate() = 0;
100 virtual bool IsActive() const = 0;
101 virtual void Maximize() = 0;
102 virtual void Minimize() = 0;
103 virtual void Restore() = 0;
104 virtual bool IsMaximized() const = 0;
105 virtual bool IsMinimized() const = 0;
107 virtual bool HasCapture() const = 0;
109 virtual void SetAlwaysOnTop(bool always_on_top
) = 0;
110 virtual bool IsAlwaysOnTop() const = 0;
112 virtual void SetVisibleOnAllWorkspaces(bool always_visible
) = 0;
114 // Returns true if the title changed.
115 virtual bool SetWindowTitle(const base::string16
& title
) = 0;
117 virtual void ClearNativeFocus() = 0;
119 virtual Widget::MoveLoopResult
RunMoveLoop(
120 const gfx::Vector2d
& drag_offset
,
121 Widget::MoveLoopSource source
,
122 Widget::MoveLoopEscapeBehavior escape_behavior
) = 0;
123 virtual void EndMoveLoop() = 0;
125 virtual void SetVisibilityChangedAnimationsEnabled(bool value
) = 0;
127 // Determines whether the window should use native title bar and borders.
128 virtual bool ShouldUseNativeFrame() const = 0;
129 // Determines whether the window contents should be rendered transparently
130 // (for example, so that they can overhang onto the window title bar).
131 virtual bool ShouldWindowContentsBeTransparent() const = 0;
132 virtual void FrameTypeChanged() = 0;
134 virtual void SetFullscreen(bool fullscreen
) = 0;
135 virtual bool IsFullscreen() const = 0;
137 virtual void SetOpacity(unsigned char opacity
) = 0;
139 virtual void SetWindowIcons(const gfx::ImageSkia
& window_icon
,
140 const gfx::ImageSkia
& app_icon
) = 0;
142 virtual void InitModalType(ui::ModalType modal_type
) = 0;
144 virtual void FlashFrame(bool flash_frame
) = 0;
146 virtual void OnRootViewLayout() = 0;
148 // Called when the DesktopNativeWidgetAura's aura::Window is focused and
150 virtual void OnNativeWidgetFocus() = 0;
151 virtual void OnNativeWidgetBlur() = 0;
153 // Returns true if the Widget was closed but is still showing because of
155 virtual bool IsAnimatingClosed() const = 0;
157 // Returns true if the Widget supports translucency.
158 virtual bool IsTranslucentWindowOpacitySupported() const = 0;
163 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_H_