summaryrefslogtreecommitdiffstats
path: root/chromium/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/views/widget/desktop_aura/desktop_native_widget_aura.h')
-rw-r--r--chromium/ui/views/widget/desktop_aura/desktop_native_widget_aura.h117
1 files changed, 64 insertions, 53 deletions
diff --git a/chromium/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/chromium/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
index 639210f3f4f..16a56d951bc 100644
--- a/chromium/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
+++ b/chromium/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
@@ -6,18 +6,20 @@
#define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_
#include "base/memory/weak_ptr.h"
-#include "ui/aura/client/activation_change_observer.h"
-#include "ui/aura/client/activation_delegate.h"
-#include "ui/aura/client/drag_drop_delegate.h"
#include "ui/aura/client/focus_change_observer.h"
-#include "ui/aura/root_window_observer.h"
#include "ui/aura/window_delegate.h"
+#include "ui/aura/window_tree_host_observer.h"
#include "ui/base/cursor/cursor.h"
#include "ui/views/ime/input_method_delegate.h"
#include "ui/views/widget/native_widget_private.h"
+#include "ui/wm/core/compound_event_filter.h"
+#include "ui/wm/public/activation_change_observer.h"
+#include "ui/wm/public/activation_delegate.h"
+#include "ui/wm/public/drag_drop_delegate.h"
namespace aura {
-class RootWindow;
+class WindowEventDispatcher;
+class WindowTreeHost;
namespace client {
class DragDropClient;
class FocusClient;
@@ -26,23 +28,25 @@ class WindowTreeClient;
}
}
-namespace views {
-
-namespace corewm {
+namespace wm {
class CompoundEventFilter;
class CursorManager;
class FocusController;
class InputMethodEventFilter;
class ShadowController;
-class TooltipController;
class VisibilityController;
class WindowModalityController;
}
+namespace views {
+namespace corewm {
+class TooltipController;
+}
class DesktopCaptureClient;
class DesktopDispatcherClient;
class DesktopEventClient;
-class DesktopRootWindowHost;
+class DesktopNativeCursorManager;
+class DesktopWindowTreeHost;
class DropHelper;
class FocusManagerEventHandler;
class TooltipManagerAura;
@@ -56,31 +60,34 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
public aura::client::FocusChangeObserver,
public views::internal::InputMethodDelegate,
public aura::client::DragDropDelegate,
- public aura::RootWindowObserver {
+ public aura::WindowTreeHostObserver {
public:
explicit DesktopNativeWidgetAura(internal::NativeWidgetDelegate* delegate);
virtual ~DesktopNativeWidgetAura();
- // Maps from window to DesktopNativeWidgetAura.
+ // Maps from window to DesktopNativeWidgetAura. |window| must be a root
+ // window.
static DesktopNativeWidgetAura* ForWindow(aura::Window* window);
- // Called by our DesktopRootWindowHost after it has deleted native resources;
+ // Called by our DesktopWindowTreeHost after it has deleted native resources;
// this is the signal that we should start our shutdown.
virtual void OnHostClosed();
- // Called from ~DesktopRootWindowHost. This takes the RootWindow as by the
- // time we get here |root_window_| is NULL.
- virtual void OnDesktopRootWindowHostDestroyed(aura::RootWindow* root);
+ // TODO(beng): remove this method and replace with an implementation of
+ // WindowDestroying() that takes the window being destroyed.
+ // Called from ~DesktopWindowTreeHost. This takes the WindowEventDispatcher
+ // as by the time we get here |dispatcher_| is NULL.
+ virtual void OnDesktopWindowTreeHostDestroyed(aura::WindowTreeHost* host);
- corewm::InputMethodEventFilter* input_method_event_filter() {
+ wm::InputMethodEventFilter* input_method_event_filter() {
return input_method_event_filter_.get();
}
- corewm::CompoundEventFilter* root_window_event_filter() {
- return root_window_event_filter_;
+ wm::CompoundEventFilter* root_window_event_filter() {
+ return root_window_event_filter_.get();
+ }
+ aura::WindowTreeHost* host() {
+ return host_.get();
}
-
- // Overridden from NativeWidget:
- virtual ui::EventHandler* GetEventHandler() OVERRIDE;
// Ensures that the correct window is activated/deactivated based on whether
// we are being activated/deactivated.
@@ -91,6 +98,7 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE;
virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
virtual bool ShouldUseNativeFrame() const OVERRIDE;
+ virtual bool ShouldWindowContentsBeTransparent() const OVERRIDE;
virtual void FrameTypeChanged() OVERRIDE;
virtual Widget* GetWidget() OVERRIDE;
virtual const Widget* GetWidget() const OVERRIDE;
@@ -110,11 +118,12 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
virtual bool HasCapture() const OVERRIDE;
virtual InputMethod* CreateInputMethod() OVERRIDE;
virtual internal::InputMethodDelegate* GetInputMethodDelegate() OVERRIDE;
+ virtual ui::InputMethod* GetHostInputMethod() OVERRIDE;
virtual void CenterWindow(const gfx::Size& size) OVERRIDE;
virtual void GetWindowPlacement(
gfx::Rect* bounds,
ui::WindowShowState* maximized) const OVERRIDE;
- virtual bool SetWindowTitle(const string16& title) OVERRIDE;
+ virtual bool SetWindowTitle(const base::string16& title) OVERRIDE;
virtual void SetWindowIcons(const gfx::ImageSkia& window_icon,
const gfx::ImageSkia& app_icon) OVERRIDE;
virtual void InitModalType(ui::ModalType modal_type) OVERRIDE;
@@ -140,6 +149,7 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
virtual bool IsActive() const OVERRIDE;
virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE;
virtual bool IsAlwaysOnTop() const OVERRIDE;
+ virtual void SetVisibleOnAllWorkspaces(bool always_visible) OVERRIDE;
virtual void Maximize() OVERRIDE;
virtual void Minimize() OVERRIDE;
virtual bool IsMaximized() const OVERRIDE;
@@ -168,6 +178,8 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE;
virtual ui::NativeTheme* GetNativeTheme() const OVERRIDE;
virtual void OnRootViewLayout() const OVERRIDE;
+ virtual bool IsTranslucentWindowOpacitySupported() const OVERRIDE;
+ virtual void RepostNativeEvent(gfx::NativeEvent native_event) OVERRIDE;
// Overridden from aura::WindowDelegate:
virtual gfx::Size GetMinimumSize() const OVERRIDE;
@@ -183,19 +195,16 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
virtual void OnCaptureLost() OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
- virtual void OnWindowDestroying() OVERRIDE;
- virtual void OnWindowDestroyed() OVERRIDE;
+ virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
+ virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE;
virtual bool HasHitTestMask() const OVERRIDE;
virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE;
- virtual void DidRecreateLayer(ui::Layer* old_layer,
- ui::Layer* new_layer) OVERRIDE;
// Overridden from ui::EventHandler:
virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
- virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// Overridden from aura::client::ActivationDelegate:
@@ -218,15 +227,15 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
virtual void OnDragExited() OVERRIDE;
virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE;
- // Overridden from aura::RootWindowObserver:
- virtual void OnRootWindowHostCloseRequested(
- const aura::RootWindow* root) OVERRIDE;
- virtual void OnRootWindowHostResized(const aura::RootWindow* root) OVERRIDE;
- virtual void OnRootWindowHostMoved(const aura::RootWindow* root,
- const gfx::Point& new_origin) OVERRIDE;
+ // Overridden from aura::WindowTreeHostObserver:
+ virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) OVERRIDE;
+ virtual void OnHostResized(const aura::WindowTreeHost* host) OVERRIDE;
+ virtual void OnHostMoved(const aura::WindowTreeHost* host,
+ const gfx::Point& new_origin) OVERRIDE;
private:
friend class FocusManagerEventHandler;
+ friend class RootWindowDestructionObserver;
// Installs the input method filter.
void InstallInputMethodEventFilter();
@@ -235,25 +244,20 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
// window is only set as transparent when the glass frame is in use.
void UpdateWindowTransparency();
+ void RootWindowDestroyed();
+
+ scoped_ptr<aura::WindowTreeHost> host_;
+ DesktopWindowTreeHost* desktop_window_tree_host_;
+
// See class documentation for Widget in widget.h for a note about ownership.
Widget::InitParams::Ownership ownership_;
scoped_ptr<DesktopCaptureClient> capture_client_;
- // The NativeWidget owns the RootWindow. Required because the RootWindow owns
- // its RootWindowHost, so DesktopRootWindowHost can't own it.
- scoped_ptr<aura::RootWindow> root_window_;
-
// The following factory is used for calls to close the NativeWidgetAura
// instance.
base::WeakPtrFactory<DesktopNativeWidgetAura> close_widget_factory_;
- // Can we be made active?
- bool can_activate_;
-
- // Ownership passed to RootWindow on Init.
- DesktopRootWindowHost* desktop_root_window_host_;
-
// Child of the root, contains |content_window_|.
aura::Window* content_window_container_;
@@ -264,9 +268,8 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
internal::NativeWidgetDelegate* native_widget_delegate_;
- scoped_ptr<corewm::FocusController> focus_client_;
+ scoped_ptr<wm::FocusController> focus_client_;
scoped_ptr<DesktopDispatcherClient> dispatcher_client_;
- scoped_ptr<views::corewm::CursorManager> cursor_client_;
scoped_ptr<aura::client::ScreenPositionClient> position_client_;
scoped_ptr<aura::client::DragDropClient> drag_drop_client_;
scoped_ptr<aura::client::WindowTreeClient> window_tree_client_;
@@ -274,9 +277,9 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
scoped_ptr<FocusManagerEventHandler> focus_manager_event_handler_;
// Toplevel event filter which dispatches to other event filters.
- corewm::CompoundEventFilter* root_window_event_filter_;
+ scoped_ptr<wm::CompoundEventFilter> root_window_event_filter_;
- scoped_ptr<corewm::InputMethodEventFilter> input_method_event_filter_;
+ scoped_ptr<wm::InputMethodEventFilter> input_method_event_filter_;
scoped_ptr<DropHelper> drop_helper_;
int last_drop_operation_;
@@ -284,17 +287,25 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
scoped_ptr<corewm::TooltipController> tooltip_controller_;
scoped_ptr<TooltipManagerAura> tooltip_manager_;
- scoped_ptr<views::corewm::VisibilityController> visibility_controller_;
+ scoped_ptr<wm::VisibilityController> visibility_controller_;
- scoped_ptr<views::corewm::WindowModalityController>
+ scoped_ptr<wm::WindowModalityController>
window_modality_controller_;
- // See comments in OnLostActive().
bool restore_focus_on_activate_;
gfx::NativeCursor cursor_;
-
- scoped_ptr<corewm::ShadowController> shadow_controller_;
+ // We must manually reference count the number of users of |cursor_manager_|
+ // because the cursors created by |cursor_manager_| are shared among the
+ // DNWAs. We can't just stuff this in a LazyInstance because we need to
+ // destroy this as the last DNWA happens; we can't put it off until
+ // (potentially) after we tear down the X11 connection because that's a
+ // crash.
+ static int cursor_reference_count_;
+ static wm::CursorManager* cursor_manager_;
+ static views::DesktopNativeCursorManager* native_cursor_manager_;
+
+ scoped_ptr<wm::ShadowController> shadow_controller_;
// Reorders child windows of |window_| associated with a view based on the
// order of the associated views in the widget's view hierarchy.