summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-26 18:12:06 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-26 18:12:06 +0000
commitd525dfd45eeb3f6e5172f7d0d194a4cac43204d2 (patch)
treed5726beb313bac9f70568e7b4b470dc5a873151c
parent00dde4c3d606d2d989df81d73b996ce0a1fe1f73 (diff)
downloadchromium_src-d525dfd45eeb3f6e5172f7d0d194a4cac43204d2.zip
chromium_src-d525dfd45eeb3f6e5172f7d0d194a4cac43204d2.tar.gz
chromium_src-d525dfd45eeb3f6e5172f7d0d194a4cac43204d2.tar.bz2
Move GetCursor() method from WindowDelegate to its own delegate interface CursorDelegate.
R=sky@chromium.org http://crbug.com/308845 Review URL: https://codereview.chromium.org/211733003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259631 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/display/cursor_window_controller.cc3
-rw-r--r--ash/drag_drop/drag_drop_controller.cc3
-rw-r--r--ash/root_window_controller.cc3
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc16
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.h6
-rw-r--r--content/browser/web_contents/aura/image_window_delegate.cc4
-rw-r--r--content/browser/web_contents/aura/image_window_delegate.h1
-rw-r--r--content/browser/web_contents/web_contents_view_aura.cc4
-rw-r--r--content/browser/web_contents/web_contents_view_aura.h1
-rw-r--r--content/content_browser.gypi1
-rw-r--r--mojo/examples/aura_demo/aura_demo.cc3
-rw-r--r--ui/aura/demo/demo_main.cc3
-rw-r--r--ui/aura/test/test_window_delegate.cc4
-rw-r--r--ui/aura/test/test_window_delegate.h1
-rw-r--r--ui/aura/window.cc4
-rw-r--r--ui/aura/window.h3
-rw-r--r--ui/aura/window_delegate.h4
-rw-r--r--ui/keyboard/keyboard_controller.cc3
-rw-r--r--ui/views/controls/native/native_view_host_aura.cc8
-rw-r--r--ui/views/widget/desktop_aura/desktop_native_widget_aura.cc13
-rw-r--r--ui/views/widget/desktop_aura/desktop_native_widget_aura.h8
-rw-r--r--ui/views/widget/native_widget_aura.cc12
-rw-r--r--ui/views/widget/native_widget_aura.h8
-rw-r--r--ui/wm/core/compound_event_filter.cc5
-rw-r--r--ui/wm/public/cursor_delegate.cc24
-rw-r--r--ui/wm/public/cursor_delegate.h35
-rw-r--r--ui/wm/wm.gyp2
27 files changed, 116 insertions, 66 deletions
diff --git a/ash/display/cursor_window_controller.cc b/ash/display/cursor_window_controller.cc
index abc5175..7206071 100644
--- a/ash/display/cursor_window_controller.cc
+++ b/ash/display/cursor_window_controller.cc
@@ -34,9 +34,6 @@ class CursorWindowDelegate : public aura::WindowDelegate {
virtual gfx::Size GetMaximumSize() const OVERRIDE { return size_; }
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE {}
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE {
- return gfx::kNullCursor;
- }
virtual int GetNonClientComponent(
const gfx::Point& point) const OVERRIDE {
return HTNOWHERE;
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index cc8d96b..5426ac1 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -95,9 +95,6 @@ class DragDropTrackerDelegate : public aura::WindowDelegate {
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE {}
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE {
- return gfx::kNullCursor;
- }
virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE {
return HTCAPTION;
}
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 429c9c5..7dcaff9 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -221,9 +221,6 @@ class EmptyWindowDelegate : public aura::WindowDelegate {
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE {
}
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE {
- return gfx::kNullCursor;
- }
virtual int GetNonClientComponent(
const gfx::Point& point) const OVERRIDE {
return HTNOWHERE;
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 27079a8..0f7aadf 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -2604,12 +2604,6 @@ void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds,
SetSize(new_bounds.size());
}
-gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) {
- if (mouse_locked_)
- return ui::kCursorNone;
- return current_cursor_.GetNativeCursor();
-}
-
int RenderWidgetHostViewAura::GetNonClientComponent(
const gfx::Point& point) const {
return HTCLIENT;
@@ -3052,6 +3046,16 @@ void RenderWidgetHostViewAura::OnCursorVisibilityChanged(bool is_visible) {
}
////////////////////////////////////////////////////////////////////////////////
+// RenderWidgetHostViewAura, wm::CursorDelegate implementation:
+
+gfx::NativeCursor RenderWidgetHostViewAura::GetCursorForPoint(
+ const gfx::Point& point) {
+ if (mouse_locked_)
+ return ui::kCursorNone;
+ return current_cursor_.GetNativeCursor();
+}
+
+////////////////////////////////////////////////////////////////////////////////
// RenderWidgetHostViewAura, aura::client::FocusChangeObserver implementation:
void RenderWidgetHostViewAura::OnWindowFocused(aura::Window* gained_focus,
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h
index e799d2c..95bbc27 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.h
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -42,6 +42,7 @@
#include "ui/gfx/rect.h"
#include "ui/wm/public/activation_change_observer.h"
#include "ui/wm/public/activation_delegate.h"
+#include "ui/wm/public/cursor_delegate.h"
namespace aura {
class WindowTracker;
@@ -96,6 +97,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
public aura::client::ActivationChangeObserver,
public aura::client::FocusChangeObserver,
public aura::client::CursorClientObserver,
+ public wm::CursorDelegate,
public ImageTransportFactoryObserver,
public BrowserAccessibilityDelegate,
public SoftwareFrameManagerClient,
@@ -288,7 +290,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
virtual gfx::Size GetMaximumSize() const OVERRIDE;
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE;
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE;
virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
virtual bool ShouldDescendIntoChildForEventHandling(
aura::Window* child,
@@ -320,6 +321,9 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
// Overridden from aura::client::CursorClientObserver:
virtual void OnCursorVisibilityChanged(bool is_visible) OVERRIDE;
+ // Overridden from wm::CursorDelegate:
+ virtual gfx::NativeCursor GetCursorForPoint(const gfx::Point& point) OVERRIDE;
+
// Overridden from aura::client::FocusChangeObserver:
virtual void OnWindowFocused(aura::Window* gained_focus,
aura::Window* lost_focus) OVERRIDE;
diff --git a/content/browser/web_contents/aura/image_window_delegate.cc b/content/browser/web_contents/aura/image_window_delegate.cc
index 0b40c0f..1fd3567 100644
--- a/content/browser/web_contents/aura/image_window_delegate.cc
+++ b/content/browser/web_contents/aura/image_window_delegate.cc
@@ -43,10 +43,6 @@ void ImageWindowDelegate::OnBoundsChanged(const gfx::Rect& old_bounds,
size_mismatch_ = window_size_ != image_.AsImageSkia().size();
}
-gfx::NativeCursor ImageWindowDelegate::GetCursor(const gfx::Point& point) {
- return gfx::kNullCursor;
-}
-
int ImageWindowDelegate::GetNonClientComponent(const gfx::Point& point) const {
return HTNOWHERE;
}
diff --git a/content/browser/web_contents/aura/image_window_delegate.h b/content/browser/web_contents/aura/image_window_delegate.h
index d0f9b06..4c3784f 100644
--- a/content/browser/web_contents/aura/image_window_delegate.h
+++ b/content/browser/web_contents/aura/image_window_delegate.h
@@ -29,7 +29,6 @@ class CONTENT_EXPORT ImageWindowDelegate : public aura::WindowDelegate {
virtual gfx::Size GetMaximumSize() const OVERRIDE;
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE;
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE;
virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
virtual bool ShouldDescendIntoChildForEventHandling(
aura::Window* child,
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index 3a87d47..7ec7470 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -1371,10 +1371,6 @@ void WebContentsViewAura::OnBoundsChanged(const gfx::Rect& old_bounds,
}
}
-gfx::NativeCursor WebContentsViewAura::GetCursor(const gfx::Point& point) {
- return gfx::kNullCursor;
-}
-
int WebContentsViewAura::GetNonClientComponent(const gfx::Point& point) const {
return HTCLIENT;
}
diff --git a/content/browser/web_contents/web_contents_view_aura.h b/content/browser/web_contents/web_contents_view_aura.h
index e472a36..4cca4a9 100644
--- a/content/browser/web_contents/web_contents_view_aura.h
+++ b/content/browser/web_contents/web_contents_view_aura.h
@@ -154,7 +154,6 @@ class CONTENT_EXPORT WebContentsViewAura
virtual gfx::Size GetMaximumSize() const OVERRIDE;
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE;
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE;
virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
virtual bool ShouldDescendIntoChildForEventHandling(
aura::Window* child,
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index ae412ed..a7f067a 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -1671,6 +1671,7 @@
'dependencies': [
'../ui/aura/aura.gyp:aura',
'../ui/base/strings/ui_strings.gyp:ui_strings',
+ '../ui/wm/wm.gyp:wm_core',
],
'sources/': [
['exclude', '^browser/renderer_host/gtk_im_context_wrapper.cc'],
diff --git a/mojo/examples/aura_demo/aura_demo.cc b/mojo/examples/aura_demo/aura_demo.cc
index b176f6d..237f6aa 100644
--- a/mojo/examples/aura_demo/aura_demo.cc
+++ b/mojo/examples/aura_demo/aura_demo.cc
@@ -54,9 +54,6 @@ class DemoWindowDelegate : public aura::WindowDelegate {
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE {}
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE {
- return gfx::kNullCursor;
- }
virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE {
return HTCAPTION;
}
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc
index 548aede..a7a21cc 100644
--- a/ui/aura/demo/demo_main.cc
+++ b/ui/aura/demo/demo_main.cc
@@ -49,9 +49,6 @@ class DemoWindowDelegate : public aura::WindowDelegate {
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE {}
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE {
- return gfx::kNullCursor;
- }
virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE {
return HTCAPTION;
}
diff --git a/ui/aura/test/test_window_delegate.cc b/ui/aura/test/test_window_delegate.cc
index 7f0ca1b..127c545 100644
--- a/ui/aura/test/test_window_delegate.cc
+++ b/ui/aura/test/test_window_delegate.cc
@@ -50,10 +50,6 @@ void TestWindowDelegate::OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
}
-gfx::NativeCursor TestWindowDelegate::GetCursor(const gfx::Point& point) {
- return gfx::kNullCursor;
-}
-
int TestWindowDelegate::GetNonClientComponent(const gfx::Point& point) const {
return window_component_;
}
diff --git a/ui/aura/test/test_window_delegate.h b/ui/aura/test/test_window_delegate.h
index 6f36e44..e100116 100644
--- a/ui/aura/test/test_window_delegate.h
+++ b/ui/aura/test/test_window_delegate.h
@@ -46,7 +46,6 @@ class TestWindowDelegate : public WindowDelegate {
virtual gfx::Size GetMaximumSize() const OVERRIDE;
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE;
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE;
virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
virtual bool ShouldDescendIntoChildForEventHandling(
Window* child,
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 86c9046..f3b8d5a 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -622,10 +622,6 @@ void Window::MoveCursorTo(const gfx::Point& point_in_window) {
root_window->GetHost()->MoveCursorTo(point_in_root);
}
-gfx::NativeCursor Window::GetCursor(const gfx::Point& point) const {
- return delegate_ ? delegate_->GetCursor(point) : gfx::kNullCursor;
-}
-
void Window::SetEventFilter(ui::EventHandler* event_filter) {
if (event_filter_)
RemovePreTargetHandler(event_filter_.get());
diff --git a/ui/aura/window.h b/ui/aura/window.h
index 2324533..b74e605 100644
--- a/ui/aura/window.h
+++ b/ui/aura/window.h
@@ -217,9 +217,6 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
// Moves the cursor to the specified location relative to the window.
virtual void MoveCursorTo(const gfx::Point& point_in_window);
- // Returns the cursor for the specified point, in window coordinates.
- gfx::NativeCursor GetCursor(const gfx::Point& point) const;
-
// Sets an 'event filter' for the window. An 'event filter' for a Window is
// a pre-target event handler, where the window owns the handler. A window
// can have only one such event filter. Setting a new filter removes and
diff --git a/ui/aura/window_delegate.h b/ui/aura/window_delegate.h
index 90e978a..ce0a457 100644
--- a/ui/aura/window_delegate.h
+++ b/ui/aura/window_delegate.h
@@ -44,10 +44,6 @@ class AURA_EXPORT WindowDelegate : public ui::EventHandler {
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) = 0;
- // Returns the native cursor for the specified point, in window coordinates,
- // or NULL for the default cursor.
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) = 0;
-
// Returns the non-client component (see hit_test.h) containing |point|, in
// window coordinates.
virtual int GetNonClientComponent(const gfx::Point& point) const = 0;
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc
index 1de832c..72f16ce 100644
--- a/ui/keyboard/keyboard_controller.cc
+++ b/ui/keyboard/keyboard_controller.cc
@@ -84,9 +84,6 @@ class KeyboardWindowDelegate : public aura::WindowDelegate {
const gfx::Rect& new_bounds) OVERRIDE {
bounds_ = new_bounds;
}
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE {
- return gfx::kNullCursor;
- }
virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE {
return HTNOWHERE;
}
diff --git a/ui/views/controls/native/native_view_host_aura.cc b/ui/views/controls/native/native_view_host_aura.cc
index 49bf733..edd65a6 100644
--- a/ui/views/controls/native/native_view_host_aura.cc
+++ b/ui/views/controls/native/native_view_host_aura.cc
@@ -11,6 +11,7 @@
#include "ui/views/controls/native/native_view_host.h"
#include "ui/views/view_constants_aura.h"
#include "ui/views/widget/widget.h"
+#include "ui/wm/public/cursor_delegate.h"
namespace views {
@@ -102,8 +103,11 @@ gfx::NativeViewAccessible NativeViewHostAura::GetNativeViewAccessible() {
}
gfx::NativeCursor NativeViewHostAura::GetCursor(int x, int y) {
- if (host_->native_view())
- return host_->native_view()->GetCursor(gfx::Point(x, y));
+ if (host_->native_view()) {
+ wm::CursorDelegate* delegate = wm::GetCursorDelegate(host_->native_view());
+ if (delegate)
+ return delegate->GetCursorForPoint(gfx::Point(x, y));
+ }
return gfx::kNullCursor;
}
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index 8341bce..ed46dc0 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -259,6 +259,7 @@ DesktopNativeWidgetAura::DesktopNativeWidgetAura(
widget_type_(Widget::InitParams::TYPE_WINDOW) {
aura::client::SetFocusChangeObserver(content_window_, this);
aura::client::SetActivationChangeObserver(content_window_, this);
+ wm::SetCursorDelegate(content_window_, this);
}
DesktopNativeWidgetAura::~DesktopNativeWidgetAura() {
@@ -929,10 +930,6 @@ gfx::Size DesktopNativeWidgetAura::GetMaximumSize() const {
return native_widget_delegate_->GetMaximumSize();
}
-gfx::NativeCursor DesktopNativeWidgetAura::GetCursor(const gfx::Point& point) {
- return cursor_;
-}
-
int DesktopNativeWidgetAura::GetNonClientComponent(
const gfx::Point& point) const {
return native_widget_delegate_->GetNonClientComponent(point);
@@ -1160,6 +1157,14 @@ void DesktopNativeWidgetAura::OnHostMoved(const aura::WindowTreeHost* host,
}
////////////////////////////////////////////////////////////////////////////////
+// DesktopNativeWidgetAura, wm::CursorDelegate implementation:
+
+gfx::NativeCursor DesktopNativeWidgetAura::GetCursorForPoint(
+ const gfx::Point& point) {
+ return cursor_;
+}
+
+////////////////////////////////////////////////////////////////////////////////
// DesktopNativeWidgetAura, NativeWidget implementation:
ui::EventHandler* DesktopNativeWidgetAura::GetEventHandler() {
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
index c2966d9..687b0b3 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
@@ -15,6 +15,7 @@
#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/cursor_delegate.h"
#include "ui/wm/public/drag_drop_delegate.h"
namespace aura {
@@ -60,7 +61,8 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
public aura::client::FocusChangeObserver,
public views::internal::InputMethodDelegate,
public aura::client::DragDropDelegate,
- public aura::WindowTreeHostObserver {
+ public aura::WindowTreeHostObserver,
+ public wm::CursorDelegate {
public:
explicit DesktopNativeWidgetAura(internal::NativeWidgetDelegate* delegate);
virtual ~DesktopNativeWidgetAura();
@@ -186,7 +188,6 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
virtual gfx::Size GetMaximumSize() const OVERRIDE;
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE {}
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE;
virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
virtual bool ShouldDescendIntoChildForEventHandling(
aura::Window* child,
@@ -234,6 +235,9 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
virtual void OnHostMoved(const aura::WindowTreeHost* host,
const gfx::Point& new_origin) OVERRIDE;
+ // Overridden from wm::CursorDelegate:
+ virtual gfx::NativeCursor GetCursorForPoint(const gfx::Point& point) OVERRIDE;
+
private:
friend class FocusManagerEventHandler;
friend class RootWindowDestructionObserver;
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 8b36973..60a63a2 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -80,6 +80,7 @@ NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate)
saved_window_state_(ui::SHOW_STATE_DEFAULT) {
aura::client::SetFocusChangeObserver(window_, this);
aura::client::SetActivationChangeObserver(window_, this);
+ wm::SetCursorDelegate(window_, this);
}
// static
@@ -725,10 +726,6 @@ void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds,
delegate_->OnNativeWidgetSizeChanged(new_bounds.size());
}
-gfx::NativeCursor NativeWidgetAura::GetCursor(const gfx::Point& point) {
- return cursor_;
-}
-
int NativeWidgetAura::GetNonClientComponent(const gfx::Point& point) const {
return delegate_->GetNonClientComponent(point);
}
@@ -944,6 +941,13 @@ int NativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) {
}
////////////////////////////////////////////////////////////////////////////////
+// NativeWidgetAura, wm::CursorDelegate implementation:
+
+gfx::NativeCursor NativeWidgetAura::GetCursorForPoint(const gfx::Point& point) {
+ return cursor_;
+}
+
+////////////////////////////////////////////////////////////////////////////////
// NativeWidgetAura, NativeWidget implementation:
ui::EventHandler* NativeWidgetAura::GetEventHandler() {
diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h
index 6ca1e71..387eb31 100644
--- a/ui/views/widget/native_widget_aura.h
+++ b/ui/views/widget/native_widget_aura.h
@@ -16,6 +16,7 @@
#include "ui/views/widget/native_widget_private.h"
#include "ui/wm/public/activation_change_observer.h"
#include "ui/wm/public/activation_delegate.h"
+#include "ui/wm/public/cursor_delegate.h"
#include "ui/wm/public/drag_drop_delegate.h"
namespace aura {
@@ -38,7 +39,8 @@ class VIEWS_EXPORT NativeWidgetAura
public aura::client::ActivationDelegate,
public aura::client::ActivationChangeObserver,
public aura::client::FocusChangeObserver,
- public aura::client::DragDropDelegate {
+ public aura::client::DragDropDelegate,
+ public wm::CursorDelegate {
public:
explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate);
@@ -144,7 +146,6 @@ class VIEWS_EXPORT NativeWidgetAura
virtual gfx::Size GetMaximumSize() const OVERRIDE;
virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE;
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE;
virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
virtual bool ShouldDescendIntoChildForEventHandling(
aura::Window* child,
@@ -183,6 +184,9 @@ class VIEWS_EXPORT NativeWidgetAura
virtual void OnDragExited() OVERRIDE;
virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE;
+ // Overridden from wm::CursorDelegate:
+ virtual gfx::NativeCursor GetCursorForPoint(const gfx::Point& point) OVERRIDE;
+
// Overridden from NativeWidget:
virtual ui::EventHandler* GetEventHandler() OVERRIDE;
diff --git a/ui/wm/core/compound_event_filter.cc b/ui/wm/core/compound_event_filter.cc
index edb7146..6efafea 100644
--- a/ui/wm/core/compound_event_filter.cc
+++ b/ui/wm/core/compound_event_filter.cc
@@ -15,6 +15,7 @@
#include "ui/base/hit_test.h"
#include "ui/events/event.h"
#include "ui/wm/public/activation_client.h"
+#include "ui/wm/public/cursor_delegate.h"
#include "ui/wm/public/drag_drop_client.h"
#if defined(OS_CHROMEOS) && defined(USE_X11)
@@ -158,7 +159,9 @@ void CompoundEventFilter::UpdateCursor(aura::Window* target,
aura::client::CursorClient* cursor_client =
aura::client::GetCursorClient(root_window);
if (cursor_client) {
- gfx::NativeCursor cursor = target->GetCursor(event->location());
+ CursorDelegate* delegate = GetCursorDelegate(target);
+ gfx::NativeCursor cursor = delegate ?
+ delegate->GetCursorForPoint(event->location()) : gfx::kNullCursor;
if ((event->flags() & ui::EF_IS_NON_CLIENT)) {
if (target->delegate()) {
int window_component =
diff --git a/ui/wm/public/cursor_delegate.cc b/ui/wm/public/cursor_delegate.cc
new file mode 100644
index 0000000..bea259d
--- /dev/null
+++ b/ui/wm/public/cursor_delegate.cc
@@ -0,0 +1,24 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/wm/public/cursor_delegate.h"
+
+#include "ui/aura/window.h"
+#include "ui/aura/window_property.h"
+
+DECLARE_WINDOW_PROPERTY_TYPE(wm::CursorDelegate*);
+
+namespace wm {
+
+DEFINE_LOCAL_WINDOW_PROPERTY_KEY(CursorDelegate*, kCursorDelegateKey, NULL);
+
+void SetCursorDelegate(aura::Window* window, CursorDelegate* delegate) {
+ window->SetProperty(kCursorDelegateKey, delegate);
+}
+
+CursorDelegate* GetCursorDelegate(aura::Window* window) {
+ return window ? window->GetProperty(kCursorDelegateKey) : NULL;
+}
+
+} // namespace wm
diff --git a/ui/wm/public/cursor_delegate.h b/ui/wm/public/cursor_delegate.h
new file mode 100644
index 0000000..1acf4d7
--- /dev/null
+++ b/ui/wm/public/cursor_delegate.h
@@ -0,0 +1,35 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_WM_PUBLIC_CURSOR_DELEGATE_H_
+#define UI_WM_PUBLIC_CURSOR_DELEGATE_H_
+
+#include "ui/gfx/native_widget_types.h"
+#include "ui/wm/core/wm_core_export.h"
+
+namespace aura {
+class Window;
+}
+
+namespace gfx {
+class Point;
+}
+
+namespace wm {
+
+class WM_CORE_EXPORT CursorDelegate {
+ public:
+ virtual gfx::NativeCursor GetCursorForPoint(const gfx::Point& point) = 0;
+
+ protected:
+ virtual ~CursorDelegate() {}
+};
+
+WM_CORE_EXPORT void SetCursorDelegate(aura::Window* window,
+ CursorDelegate* delegate);
+WM_CORE_EXPORT CursorDelegate* GetCursorDelegate(aura::Window* window);
+
+} // namespace wm
+
+#endif // UI_WM_PUBLIC_CURSOR_DELEGATE_H_
diff --git a/ui/wm/wm.gyp b/ui/wm/wm.gyp
index a1960ec..cccadc0 100644
--- a/ui/wm/wm.gyp
+++ b/ui/wm/wm.gyp
@@ -85,6 +85,8 @@
'core/wm_core_switches.h',
'core/wm_state.cc',
'core/wm_state.h',
+ 'public/cursor_delegate.cc',
+ 'public/cursor_delegate.h',
],
},
{