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

Side by Side Diff: ui/aura/mus/mus_mouse_location_updater.cc

Issue 2818533003: Make nesting/running states a RunLoop rather than a MessageLoop concept. (Closed)
Patch Set: still need to check MessageLoop::current() in Mojo's RunLoopNestingObserver::GetForThread() Created 3 years, 7 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
« no previous file with comments | « ui/aura/mus/mus_mouse_location_updater.h ('k') | ui/aura/mus/window_tree_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/mus/mus_mouse_location_updater.h" 5 #include "ui/aura/mus/mus_mouse_location_updater.h"
6 6
7 #include "ui/aura/env.h" 7 #include "ui/aura/env.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 9
10 namespace aura { 10 namespace aura {
(...skipping 11 matching lines...) Expand all
22 return true; 22 return true;
23 default: 23 default:
24 break; 24 break;
25 } 25 }
26 return false; 26 return false;
27 } 27 }
28 28
29 } // namespace 29 } // namespace
30 30
31 MusMouseLocationUpdater::MusMouseLocationUpdater() { 31 MusMouseLocationUpdater::MusMouseLocationUpdater() {
32 base::MessageLoop::current()->AddNestingObserver(this); 32 base::RunLoop::AddNestingObserverOnCurrentThread(this);
33 } 33 }
34 34
35 MusMouseLocationUpdater::~MusMouseLocationUpdater() { 35 MusMouseLocationUpdater::~MusMouseLocationUpdater() {
36 base::MessageLoop::current()->RemoveNestingObserver(this); 36 base::RunLoop::RemoveNestingObserverOnCurrentThread(this);
37 } 37 }
38 38
39 void MusMouseLocationUpdater::OnEventProcessingStarted(const ui::Event& event) { 39 void MusMouseLocationUpdater::OnEventProcessingStarted(const ui::Event& event) {
40 if (!IsMouseEventWithLocation(event) || 40 if (!IsMouseEventWithLocation(event) ||
41 Env::GetInstance()->always_use_last_mouse_location_) { 41 Env::GetInstance()->always_use_last_mouse_location_) {
42 return; 42 return;
43 } 43 }
44 44
45 is_processing_trigger_event_ = true; 45 is_processing_trigger_event_ = true;
46 Env::GetInstance()->set_last_mouse_location( 46 Env::GetInstance()->set_last_mouse_location(
47 event.AsMouseEvent()->root_location()); 47 event.AsMouseEvent()->root_location());
48 Env::GetInstance()->get_last_mouse_location_from_mus_ = false; 48 Env::GetInstance()->get_last_mouse_location_from_mus_ = false;
49 } 49 }
50 50
51 void MusMouseLocationUpdater::OnEventProcessingFinished() { 51 void MusMouseLocationUpdater::OnEventProcessingFinished() {
52 UseCursorScreenPoint(); 52 UseCursorScreenPoint();
53 } 53 }
54 54
55 void MusMouseLocationUpdater::UseCursorScreenPoint() { 55 void MusMouseLocationUpdater::UseCursorScreenPoint() {
56 if (!is_processing_trigger_event_) 56 if (!is_processing_trigger_event_)
57 return; 57 return;
58 58
59 is_processing_trigger_event_ = false; 59 is_processing_trigger_event_ = false;
60 Env::GetInstance()->get_last_mouse_location_from_mus_ = true; 60 Env::GetInstance()->get_last_mouse_location_from_mus_ = true;
61 } 61 }
62 62
63 void MusMouseLocationUpdater::OnBeginNestedMessageLoop() { 63 void MusMouseLocationUpdater::OnBeginNestedRunLoop() {
64 UseCursorScreenPoint(); 64 UseCursorScreenPoint();
65 } 65 }
66 66
67 } // namespace aura 67 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/mus_mouse_location_updater.h ('k') | ui/aura/mus/window_tree_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698