Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: ui/aura/root_window.cc

Issue 10919135: Move ash specific cursor code to CursorManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "ui/aura/aura_switches.h" 15 #include "ui/aura/aura_switches.h"
16 #include "ui/aura/client/activation_client.h" 16 #include "ui/aura/client/activation_client.h"
17 #include "ui/aura/client/capture_client.h" 17 #include "ui/aura/client/capture_client.h"
18 #include "ui/aura/client/drag_drop_client.h"
19 #include "ui/aura/client/event_client.h" 18 #include "ui/aura/client/event_client.h"
20 #include "ui/aura/client/screen_position_client.h" 19 #include "ui/aura/client/screen_position_client.h"
21 #include "ui/aura/display_manager.h" 20 #include "ui/aura/display_manager.h"
22 #include "ui/aura/env.h" 21 #include "ui/aura/env.h"
23 #include "ui/aura/event_filter.h" 22 #include "ui/aura/event_filter.h"
24 #include "ui/aura/focus_manager.h" 23 #include "ui/aura/focus_manager.h"
25 #include "ui/aura/root_window_host.h" 24 #include "ui/aura/root_window_host.h"
26 #include "ui/aura/root_window_observer.h" 25 #include "ui/aura/root_window_observer.h"
27 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
28 #include "ui/aura/window_delegate.h" 27 #include "ui/aura/window_delegate.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 CancelLock(); 96 CancelLock();
98 } 97 }
99 98
100 void CompositorLock::CancelLock() { 99 void CompositorLock::CancelLock() {
101 if (!root_window_) 100 if (!root_window_)
102 return; 101 return;
103 root_window_->UnlockCompositor(); 102 root_window_->UnlockCompositor();
104 root_window_ = NULL; 103 root_window_ = NULL;
105 } 104 }
106 105
107 bool RootWindow::hide_host_cursor_ = false;
108
109 //////////////////////////////////////////////////////////////////////////////// 106 ////////////////////////////////////////////////////////////////////////////////
110 // RootWindow, public: 107 // RootWindow, public:
111 108
112 RootWindow::RootWindow(const gfx::Rect& initial_bounds) 109 RootWindow::RootWindow(const gfx::Rect& initial_bounds)
113 : Window(NULL), 110 : Window(NULL),
114 ALLOW_THIS_IN_INITIALIZER_LIST( 111 ALLOW_THIS_IN_INITIALIZER_LIST(
115 host_(RootWindowHost::Create(this, initial_bounds))), 112 host_(RootWindowHost::Create(this, initial_bounds))),
116 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)), 113 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)),
117 ALLOW_THIS_IN_INITIALIZER_LIST(event_factory_(this)), 114 ALLOW_THIS_IN_INITIALIZER_LIST(event_factory_(this)),
118 mouse_button_flags_(0), 115 mouse_button_flags_(0),
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 SetLastMouseLocation(this, ui::ConvertPointToDIP(layer(), point)); 220 SetLastMouseLocation(this, ui::ConvertPointToDIP(layer(), point));
224 221
225 synthesize_mouse_move_ = false; 222 synthesize_mouse_move_ = false;
226 } 223 }
227 224
228 gfx::Point RootWindow::GetHostOrigin() const { 225 gfx::Point RootWindow::GetHostOrigin() const {
229 return host_->GetBounds().origin(); 226 return host_->GetBounds().origin();
230 } 227 }
231 228
232 void RootWindow::SetCursor(gfx::NativeCursor cursor) { 229 void RootWindow::SetCursor(gfx::NativeCursor cursor) {
233 // If a drag is in progress, the DragDropClient should override the cursor.
234 client::DragDropClient* dnd_client = client::GetDragDropClient(this);
235 if (dnd_client && dnd_client->IsDragDropInProgress())
236 cursor = dnd_client->GetDragCursor();
237
238 last_cursor_ = cursor; 230 last_cursor_ = cursor;
239 // A lot of code seems to depend on NULL cursors actually showing an arrow, 231 // A lot of code seems to depend on NULL cursors actually showing an arrow,
240 // so just pass everything along to the host. 232 // so just pass everything along to the host.
241 host_->SetCursor(cursor); 233 host_->SetCursor(cursor);
242 } 234 }
243 235
244 void RootWindow::ShowCursor(bool show) { 236 void RootWindow::ShowCursor(bool show) {
245 // Send entered / exited so that visual state can be updated to match 237 // Send entered / exited so that visual state can be updated to match
246 // cursor state. 238 // cursor state.
247 if (show != cursor_shown_) { 239 if (show != cursor_shown_) {
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 void RootWindow::UnlockCompositor() { 1058 void RootWindow::UnlockCompositor() {
1067 DCHECK(compositor_lock_); 1059 DCHECK(compositor_lock_);
1068 compositor_lock_ = NULL; 1060 compositor_lock_ = NULL;
1069 if (draw_on_compositor_unlock_) { 1061 if (draw_on_compositor_unlock_) {
1070 draw_on_compositor_unlock_ = false; 1062 draw_on_compositor_unlock_ = false;
1071 ScheduleDraw(); 1063 ScheduleDraw();
1072 } 1064 }
1073 } 1065 }
1074 1066
1075 } // namespace aura 1067 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698