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

Unified Diff: ui/views/mus/window_manager_connection.cc

Issue 2167643005: Revert of mus: Rename .*PointerWatcher.* to .*PointerDownWatcher.*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolve conflicts Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/mus/window_manager_connection.h ('k') | ui/views/mus/window_manager_connection_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/window_manager_connection.cc
diff --git a/ui/views/mus/window_manager_connection.cc b/ui/views/mus/window_manager_connection.cc
index ba6ee9491ad8dc71e4869f11f7379bc1d54bf526..6ad419589a43415de1d3844bf96a35fe703cff41 100644
--- a/ui/views/mus/window_manager_connection.cc
+++ b/ui/views/mus/window_manager_connection.cc
@@ -20,7 +20,7 @@
#include "ui/views/mus/clipboard_mus.h"
#include "ui/views/mus/native_widget_mus.h"
#include "ui/views/mus/screen_mus.h"
-#include "ui/views/pointer_down_watcher.h"
+#include "ui/views/pointer_watcher.h"
#include "ui/views/touch_event_watcher.h"
#include "ui/views/views_delegate.h"
@@ -95,12 +95,11 @@ NativeWidget* WindowManagerConnection::CreateNativeWidgetMus(
ui::mojom::SurfaceType::DEFAULT);
}
-void WindowManagerConnection::AddPointerDownWatcher(
- PointerDownWatcher* watcher) {
+void WindowManagerConnection::AddPointerWatcher(PointerWatcher* watcher) {
// TODO(riajiang): Support multiple event matchers (crbug.com/627146).
DCHECK(!HasTouchEventWatcher());
- bool had_watcher = HasPointerDownWatcher();
- pointer_down_watchers_.AddObserver(watcher);
+ bool had_watcher = HasPointerWatcher();
+ pointer_watchers_.AddObserver(watcher);
if (!had_watcher) {
// Start a watcher for pointer down.
// TODO(jamescook): Extend event observers to handle multiple event types.
@@ -111,18 +110,17 @@ void WindowManagerConnection::AddPointerDownWatcher(
}
}
-void WindowManagerConnection::RemovePointerDownWatcher(
- PointerDownWatcher* watcher) {
- pointer_down_watchers_.RemoveObserver(watcher);
- if (!HasPointerDownWatcher()) {
- // Last PointerDownWatcher removed, stop the event observer.
+void WindowManagerConnection::RemovePointerWatcher(PointerWatcher* watcher) {
+ pointer_watchers_.RemoveObserver(watcher);
+ if (!HasPointerWatcher()) {
+ // Last PointerWatcher removed, stop the event observer.
client_->SetEventObserver(nullptr);
}
}
void WindowManagerConnection::AddTouchEventWatcher(TouchEventWatcher* watcher) {
// TODO(riajiang): Support multiple event matchers (crbug.com/627146).
- DCHECK(!HasPointerDownWatcher());
+ DCHECK(!HasPointerWatcher());
bool had_watcher = HasTouchEventWatcher();
touch_event_watchers_.AddObserver(watcher);
if (!had_watcher) {
@@ -170,12 +168,11 @@ WindowManagerConnection::WindowManagerConnection(
std::map<std::string, std::vector<uint8_t>>()));
}
-bool WindowManagerConnection::HasPointerDownWatcher() {
+bool WindowManagerConnection::HasPointerWatcher() {
// Check to see if we really have any observers left. This doesn't use
// base::ObserverList<>::might_have_observers() because that returns true
// during iteration over the list even when the last observer is removed.
- base::ObserverList<PointerDownWatcher>::Iterator iterator(
- &pointer_down_watchers_);
+ base::ObserverList<PointerWatcher>::Iterator iterator(&pointer_watchers_);
return !!iterator.GetNext();
}
@@ -212,13 +209,13 @@ void WindowManagerConnection::OnEventObserved(const ui::Event& event,
// to store screen coordinates. Screen coordinates really should be returned
// separately. See http://crbug.com/608547
gfx::Point location_in_screen = event.AsLocatedEvent()->root_location();
- if (HasPointerDownWatcher()) {
+ if (HasPointerWatcher()) {
if (event.type() == ui::ET_MOUSE_PRESSED) {
- FOR_EACH_OBSERVER(PointerDownWatcher, pointer_down_watchers_,
+ FOR_EACH_OBSERVER(PointerWatcher, pointer_watchers_,
OnMousePressed(*event.AsMouseEvent(),
location_in_screen, target_widget));
} else if (event.type() == ui::ET_TOUCH_PRESSED) {
- FOR_EACH_OBSERVER(PointerDownWatcher, pointer_down_watchers_,
+ FOR_EACH_OBSERVER(PointerWatcher, pointer_watchers_,
OnTouchPressed(*event.AsTouchEvent(),
location_in_screen, target_widget));
}
« no previous file with comments | « ui/views/mus/window_manager_connection.h ('k') | ui/views/mus/window_manager_connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698