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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 111043002: Cursor state should be global for desktop Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated patch Created 7 years 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/views/widget/desktop_aura/desktop_native_widget_aura.h" 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "ui/aura/client/activation_client.h" 9 #include "ui/aura/client/activation_client.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 private: 194 private:
195 DesktopNativeWidgetAura* desktop_native_widget_aura_; 195 DesktopNativeWidgetAura* desktop_native_widget_aura_;
196 196
197 DISALLOW_COPY_AND_ASSIGN(FocusManagerEventHandler); 197 DISALLOW_COPY_AND_ASSIGN(FocusManagerEventHandler);
198 }; 198 };
199 199
200 //////////////////////////////////////////////////////////////////////////////// 200 ////////////////////////////////////////////////////////////////////////////////
201 // DesktopNativeWidgetAura, public: 201 // DesktopNativeWidgetAura, public:
202 202
203 DesktopNativeCursorManager* DesktopNativeWidgetAura::native_cursor_manager_ =
204 NULL;
205 views::corewm::CursorManager* DesktopNativeWidgetAura::cursor_manager_ = NULL;
206
203 DesktopNativeWidgetAura::DesktopNativeWidgetAura( 207 DesktopNativeWidgetAura::DesktopNativeWidgetAura(
204 internal::NativeWidgetDelegate* delegate) 208 internal::NativeWidgetDelegate* delegate)
205 : ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), 209 : ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
206 close_widget_factory_(this), 210 close_widget_factory_(this),
207 can_activate_(true), 211 can_activate_(true),
208 desktop_root_window_host_(NULL), 212 desktop_root_window_host_(NULL),
209 content_window_container_(NULL), 213 content_window_container_(NULL),
210 content_window_(new aura::Window(this)), 214 content_window_(new aura::Window(this)),
211 native_widget_delegate_(delegate), 215 native_widget_delegate_(delegate),
212 last_drop_operation_(ui::DragDropTypes::DRAG_NONE), 216 last_drop_operation_(ui::DragDropTypes::DRAG_NONE),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // |root_window_| is still valid, but DesktopRootWindowHost is nearly 282 // |root_window_| is still valid, but DesktopRootWindowHost is nearly
279 // destroyed. Do cleanup here of members DesktopRootWindowHost may also use. 283 // destroyed. Do cleanup here of members DesktopRootWindowHost may also use.
280 aura::client::SetFocusClient(root->window(), NULL); 284 aura::client::SetFocusClient(root->window(), NULL);
281 aura::client::SetActivationClient(root->window(), NULL); 285 aura::client::SetActivationClient(root->window(), NULL);
282 focus_client_.reset(); 286 focus_client_.reset();
283 287
284 aura::client::SetDispatcherClient(root->window(), NULL); 288 aura::client::SetDispatcherClient(root->window(), NULL);
285 dispatcher_client_.reset(); 289 dispatcher_client_.reset();
286 290
287 aura::client::SetCursorClient(root->window(), NULL); 291 aura::client::SetCursorClient(root->window(), NULL);
288 cursor_client_.reset(); 292 native_cursor_manager_->RemoveRootWindow(root);
289 293
290 aura::client::SetScreenPositionClient(root->window(), NULL); 294 aura::client::SetScreenPositionClient(root->window(), NULL);
291 position_client_.reset(); 295 position_client_.reset();
292 296
293 aura::client::SetDragDropClient(root->window(), NULL); 297 aura::client::SetDragDropClient(root->window(), NULL);
294 drag_drop_client_.reset(); 298 drag_drop_client_.reset();
295 299
296 aura::client::SetEventClient(root->window(), NULL); 300 aura::client::SetEventClient(root->window(), NULL);
297 event_client_.reset(); 301 event_client_.reset();
298 } 302 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // OnRootWindowHostCreated() is invoked. 378 // OnRootWindowHostCreated() is invoked.
375 379
376 // CEF sets focus to the window the user clicks down on. 380 // CEF sets focus to the window the user clicks down on.
377 // TODO(beng): see if we can't do this some other way. CEF seems a heavy- 381 // TODO(beng): see if we can't do this some other way. CEF seems a heavy-
378 // handed way of accomplishing focus. 382 // handed way of accomplishing focus.
379 // No event filter for aura::Env. Create CompoundEvnetFilter per RootWindow. 383 // No event filter for aura::Env. Create CompoundEvnetFilter per RootWindow.
380 root_window_event_filter_ = new corewm::CompoundEventFilter; 384 root_window_event_filter_ = new corewm::CompoundEventFilter;
381 // Pass ownership of the filter to the root_window. 385 // Pass ownership of the filter to the root_window.
382 root_window_->window()->SetEventFilter(root_window_event_filter_); 386 root_window_->window()->SetEventFilter(root_window_event_filter_);
383 387
388 // |root_window_| must be added to |native_cursor_manager_| before
389 // OnRootWindowCreated() is called.
390 if (!native_cursor_manager_) {
391 native_cursor_manager_ = new DesktopNativeCursorManager(
392 DesktopCursorLoaderUpdater::Create());
393 }
394 if (!cursor_manager_) {
395 cursor_manager_ = new views::corewm::CursorManager(
396 scoped_ptr<corewm::NativeCursorManager>(native_cursor_manager_));
397 }
398 native_cursor_manager_->AddRootWindow(root_window_.get());
399 aura::client::SetCursorClient(root_window_->window(), cursor_manager_);
400
384 desktop_root_window_host_->OnRootWindowCreated(root_window_.get(), params); 401 desktop_root_window_host_->OnRootWindowCreated(root_window_.get(), params);
385 402
386 UpdateWindowTransparency(); 403 UpdateWindowTransparency();
387 404
388 capture_client_.reset(new DesktopCaptureClient(root_window_->window())); 405 capture_client_.reset(new DesktopCaptureClient(root_window_->window()));
389 406
390 corewm::FocusController* focus_controller = 407 corewm::FocusController* focus_controller =
391 new corewm::FocusController(new DesktopFocusRules(content_window_)); 408 new corewm::FocusController(new DesktopFocusRules(content_window_));
392 focus_client_.reset(focus_controller); 409 focus_client_.reset(focus_controller);
393 aura::client::SetFocusClient(root_window_->window(), focus_controller); 410 aura::client::SetFocusClient(root_window_->window(), focus_controller);
394 aura::client::SetActivationClient(root_window_->window(), focus_controller); 411 aura::client::SetActivationClient(root_window_->window(), focus_controller);
395 root_window_->window()->AddPreTargetHandler(focus_controller); 412 root_window_->window()->AddPreTargetHandler(focus_controller);
396 413
397 dispatcher_client_.reset(new DesktopDispatcherClient); 414 dispatcher_client_.reset(new DesktopDispatcherClient);
398 aura::client::SetDispatcherClient(root_window_->window(), 415 aura::client::SetDispatcherClient(root_window_->window(),
399 dispatcher_client_.get()); 416 dispatcher_client_.get());
400 417
401 DesktopNativeCursorManager* desktop_native_cursor_manager =
402 new views::DesktopNativeCursorManager(
403 root_window_.get(),
404 DesktopCursorLoaderUpdater::Create());
405 cursor_client_.reset(
406 new views::corewm::CursorManager(
407 scoped_ptr<corewm::NativeCursorManager>(
408 desktop_native_cursor_manager)));
409 aura::client::SetCursorClient(root_window_->window(), cursor_client_.get());
410
411 position_client_.reset(new DesktopScreenPositionClient()); 418 position_client_.reset(new DesktopScreenPositionClient());
412 aura::client::SetScreenPositionClient(root_window_->window(), 419 aura::client::SetScreenPositionClient(root_window_->window(),
413 position_client_.get()); 420 position_client_.get());
414 421
415 InstallInputMethodEventFilter(); 422 InstallInputMethodEventFilter();
416 423
417 drag_drop_client_ = desktop_root_window_host_->CreateDragDropClient( 424 drag_drop_client_ = desktop_root_window_host_->CreateDragDropClient(
418 desktop_native_cursor_manager); 425 native_cursor_manager_);
419 aura::client::SetDragDropClient(root_window_->window(), 426 aura::client::SetDragDropClient(root_window_->window(),
420 drag_drop_client_.get()); 427 drag_drop_client_.get());
421 428
422 focus_client_->FocusWindow(content_window_); 429 focus_client_->FocusWindow(content_window_);
423 430
424 OnRootWindowHostResized(root_window_.get()); 431 OnRootWindowHostResized(root_window_.get());
425 432
426 root_window_->AddRootWindowObserver(this); 433 root_window_->AddRootWindowObserver(this);
427 434
428 window_tree_client_.reset( 435 window_tree_client_.reset(
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 input_method_event_filter_->SetInputMethodPropertyInRootWindow( 1116 input_method_event_filter_->SetInputMethodPropertyInRootWindow(
1110 root_window_->window()); 1117 root_window_->window());
1111 root_window_event_filter_->AddHandler(input_method_event_filter_.get()); 1118 root_window_event_filter_->AddHandler(input_method_event_filter_.get());
1112 } 1119 }
1113 1120
1114 void DesktopNativeWidgetAura::UpdateWindowTransparency() { 1121 void DesktopNativeWidgetAura::UpdateWindowTransparency() {
1115 content_window_->SetTransparent(ShouldUseNativeFrame()); 1122 content_window_->SetTransparent(ShouldUseNativeFrame());
1116 } 1123 }
1117 1124
1118 } // namespace views 1125 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698