diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-06 06:37:09 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-06 06:37:09 +0000 |
commit | 1aad332c7d47b1adc56708130d36dc1f513b67ae (patch) | |
tree | 9103e4927e301881f73e5798d4cac8f2f4986afd /ash/drag_drop | |
parent | 382a064036206876b25fdd9052fe073721bebbb5 (diff) | |
download | chromium_src-1aad332c7d47b1adc56708130d36dc1f513b67ae.zip chromium_src-1aad332c7d47b1adc56708130d36dc1f513b67ae.tar.gz chromium_src-1aad332c7d47b1adc56708130d36dc1f513b67ae.tar.bz2 |
Add EnvEventFilter to filter events before root window process event
Factor out CursorManager from RootWindowEventFilter
Review URL: https://chromiumcodereview.appspot.com/10444107
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140714 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/drag_drop')
-rw-r--r-- | ash/drag_drop/drag_drop_controller.cc | 15 | ||||
-rw-r--r-- | ash/drag_drop/drag_drop_controller_unittest.cc | 1 |
2 files changed, 7 insertions, 9 deletions
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index 366d980..51779a5 100644 --- a/ash/drag_drop/drag_drop_controller.cc +++ b/ash/drag_drop/drag_drop_controller.cc @@ -8,6 +8,7 @@ #include "ash/shell.h" #include "base/message_loop.h" #include "ui/aura/client/drag_drop_delegate.h" +#include "ui/aura/cursor_manager.h" #include "ui/aura/env.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" @@ -41,11 +42,11 @@ DragDropController::DragDropController() drag_window_(NULL), drag_drop_in_progress_(false), should_block_during_drag_drop_(true) { - Shell::GetInstance()->AddRootWindowEventFilter(this); + Shell::GetInstance()->AddEnvEventFilter(this); } DragDropController::~DragDropController() { - Shell::GetInstance()->RemoveRootWindowEventFilter(this); + Shell::GetInstance()->RemoveEnvEventFilter(this); Cleanup(); if (drag_image_.get()) drag_image_.reset(); @@ -55,6 +56,7 @@ int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data, const gfx::Point& root_location, int operation) { DCHECK(!drag_drop_in_progress_); + // TODO(oshima): Add CaptureClient client API. aura::Window* capture_window = Shell::GetPrimaryRootWindow()->capture_window(); if (capture_window) @@ -122,10 +124,7 @@ void DragDropController::DragUpdate(aura::Window* target, cursor = ui::kCursorAlias; else if (op & ui::DragDropTypes::DRAG_MOVE) cursor = ui::kCursorMove; - if (drag_window_->GetRootWindow()) - drag_window_->GetRootWindow()->SetCursor(cursor); - else - Shell::GetPrimaryRootWindow()->SetCursor(cursor); + aura::Env::GetInstance()->cursor_manager()->SetCursor(cursor); } } @@ -138,7 +137,7 @@ void DragDropController::DragUpdate(aura::Window* target, void DragDropController::Drop(aura::Window* target, const aura::LocatedEvent& event) { - Shell::GetPrimaryRootWindow()->SetCursor(ui::kCursorPointer); + aura::Env::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer); aura::client::DragDropDelegate* delegate = NULL; // We must guarantee that a target gets a OnDragEntered before Drop. WebKit @@ -167,7 +166,7 @@ void DragDropController::Drop(aura::Window* target, } void DragDropController::DragCancel() { - Shell::GetPrimaryRootWindow()->SetCursor(ui::kCursorPointer); + aura::Env::GetInstance()->cursor_manager()->SetCursor(ui::kCursorPointer); // |drag_window_| can be NULL if we have just started the drag and have not // received any DragUpdates, or, if the |drag_window_| gets destroyed during diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc index 33283db..890a3a2 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc @@ -10,7 +10,6 @@ #include "base/utf_string_conversions.h" #include "ui/aura/event.h" #include "ui/aura/root_window.h" -#include "ui/aura/shared/root_window_event_filter.h" #include "ui/aura/test/event_generator.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" |