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

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

Issue 10536033: aura: Remove --aura-disable-hold-mouse-moves flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "" Created 8 years, 6 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
« no previous file with comments | « ui/aura/root_window.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 capture_window_(NULL), 123 capture_window_(NULL),
124 mouse_pressed_handler_(NULL), 124 mouse_pressed_handler_(NULL),
125 mouse_moved_handler_(NULL), 125 mouse_moved_handler_(NULL),
126 ALLOW_THIS_IN_INITIALIZER_LIST( 126 ALLOW_THIS_IN_INITIALIZER_LIST(
127 gesture_recognizer_(ui::GestureRecognizer::Create(this))), 127 gesture_recognizer_(ui::GestureRecognizer::Create(this))),
128 synthesize_mouse_move_(false), 128 synthesize_mouse_move_(false),
129 waiting_on_compositing_end_(false), 129 waiting_on_compositing_end_(false),
130 draw_on_compositing_end_(false), 130 draw_on_compositing_end_(false),
131 defer_draw_scheduling_(false), 131 defer_draw_scheduling_(false),
132 mouse_move_hold_count_(0), 132 mouse_move_hold_count_(0),
133 should_hold_mouse_moves_(false),
134 compositor_lock_(NULL), 133 compositor_lock_(NULL),
135 draw_on_compositor_unlock_(false), 134 draw_on_compositor_unlock_(false),
136 draw_trace_count_(0) { 135 draw_trace_count_(0) {
137 SetName("RootWindow"); 136 SetName("RootWindow");
138 should_hold_mouse_moves_ = !CommandLine::ForCurrentProcess()->HasSwitch(
139 switches::kAuraDisableHoldMouseMoves);
140 137
141 compositor_.reset(new ui::Compositor(this, host_->GetAcceleratedWidget())); 138 compositor_.reset(new ui::Compositor(this, host_->GetAcceleratedWidget()));
142 DCHECK(compositor_.get()); 139 DCHECK(compositor_.get());
143 compositor_->AddObserver(this); 140 compositor_->AddObserver(this);
144 } 141 }
145 142
146 RootWindow::~RootWindow() { 143 RootWindow::~RootWindow() {
147 if (compositor_lock_) { 144 if (compositor_lock_) {
148 // No need to schedule a draw, we're going away. 145 // No need to schedule a draw, we're going away.
149 draw_on_compositor_unlock_ = false; 146 draw_on_compositor_unlock_ = false;
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 return host_->GetAcceleratedWidget(); 510 return host_->GetAcceleratedWidget();
514 } 511 }
515 512
516 #if !defined(NDEBUG) 513 #if !defined(NDEBUG)
517 void RootWindow::ToggleFullScreen() { 514 void RootWindow::ToggleFullScreen() {
518 host_->ToggleFullScreen(); 515 host_->ToggleFullScreen();
519 } 516 }
520 #endif 517 #endif
521 518
522 void RootWindow::HoldMouseMoves() { 519 void RootWindow::HoldMouseMoves() {
523 if (should_hold_mouse_moves_) 520 ++mouse_move_hold_count_;
524 ++mouse_move_hold_count_;
525 } 521 }
526 522
527 void RootWindow::ReleaseMouseMoves() { 523 void RootWindow::ReleaseMouseMoves() {
528 if (should_hold_mouse_moves_) { 524 --mouse_move_hold_count_;
529 --mouse_move_hold_count_; 525 DCHECK_GE(mouse_move_hold_count_, 0);
530 DCHECK_GE(mouse_move_hold_count_, 0); 526 if (!mouse_move_hold_count_)
531 if (!mouse_move_hold_count_) 527 DispatchHeldMouseMove();
532 DispatchHeldMouseMove();
533 }
534 } 528 }
535 529
536 scoped_refptr<CompositorLock> RootWindow::GetCompositorLock() { 530 scoped_refptr<CompositorLock> RootWindow::GetCompositorLock() {
537 if (!compositor_lock_) 531 if (!compositor_lock_)
538 compositor_lock_ = new CompositorLock(this); 532 compositor_lock_ = new CompositorLock(this);
539 return compositor_lock_; 533 return compositor_lock_;
540 } 534 }
541 535
542 void RootWindow::SetFocusWhenShown(bool focused) { 536 void RootWindow::SetFocusWhenShown(bool focused) {
543 host_->SetFocusWhenShown(focused); 537 host_->SetFocusWhenShown(focused);
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 void RootWindow::UnlockCompositor() { 1024 void RootWindow::UnlockCompositor() {
1031 DCHECK(compositor_lock_); 1025 DCHECK(compositor_lock_);
1032 compositor_lock_ = NULL; 1026 compositor_lock_ = NULL;
1033 if (draw_on_compositor_unlock_) { 1027 if (draw_on_compositor_unlock_) {
1034 draw_on_compositor_unlock_ = false; 1028 draw_on_compositor_unlock_ = false;
1035 ScheduleDraw(); 1029 ScheduleDraw();
1036 } 1030 }
1037 } 1031 }
1038 1032
1039 } // namespace aura 1033 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698