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

Unified Diff: ash/system/tray/tray_event_filter.cc

Issue 1949823002: WIP: Eliminate event.target() usage from TrayEventFilter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: container delegate Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/tray/tray_event_filter.h ('k') | ash/test/test_shell_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/tray_event_filter.cc
diff --git a/ash/system/tray/tray_event_filter.cc b/ash/system/tray/tray_event_filter.cc
index 8d2368d3a841631ab93aa8a3557ada915c1ed735..8efebc72ccfa6db5ec6b957adb84842cb5f6b59b 100644
--- a/ash/system/tray/tray_event_filter.cc
+++ b/ash/system/tray/tray_event_filter.cc
@@ -4,6 +4,7 @@
#include "ash/system/tray/tray_event_filter.h"
+#include "ash/container_delegate.h"
#include "ash/root_window_controller.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shell.h"
@@ -40,35 +41,32 @@ void TrayEventFilter::RemoveWrapper(TrayBubbleWrapper* wrapper) {
}
void TrayEventFilter::OnMousePressed(const ui::MouseEvent& event,
- const gfx::Point& location_in_screen) {
- ProcessLocatedEvent(event, location_in_screen);
+ const gfx::Point& location_in_screen,
+ views::Widget* target) {
+ ProcessPressedEvent(event, location_in_screen, target);
}
void TrayEventFilter::OnTouchPressed(const ui::TouchEvent& event,
- const gfx::Point& location_in_screen) {
- ProcessLocatedEvent(event, location_in_screen);
+ const gfx::Point& location_in_screen,
+ views::Widget* target) {
+ ProcessPressedEvent(event, location_in_screen, target);
}
-void TrayEventFilter::ProcessLocatedEvent(
+void TrayEventFilter::ProcessPressedEvent(
const ui::LocatedEvent& event,
- const gfx::Point& location_in_screen) {
- // TODO(jamescook): Rewrite this to avoid using event.target() as that will
- // always be null on mus. http://crbug.com/608570
- if (event.target()) {
- aura::Window* target = static_cast<aura::Window*>(event.target());
- // Don't process events that occurred inside an embedded menu.
- RootWindowController* root_controller =
- GetRootWindowController(target->GetRootWindow());
- if (root_controller &&
- root_controller->GetContainer(kShellWindowId_MenuContainer)
- ->Contains(target)) {
+ const gfx::Point& location_in_screen,
+ views::Widget* target) {
+ LOG(ERROR) << "JAMES ProcessPressedEvent at "
+ << location_in_screen.ToString() << " target name " << (target ? target->GetName() : "none");
+
+ if (target) {
+ ContainerDelegate* container_delegate = Shell::GetInstance()->container_delegate();
+ if (container_delegate->IsInMenuContainer(target)) {
+ LOG(ERROR) << "JAMES ProcessPressedEvent hit menu";
return;
}
- // Don't process events that occurred inside the status area widget and
- // a popup notification from message center.
- if (root_controller &&
- root_controller->GetContainer(kShellWindowId_StatusContainer)
- ->Contains(target)) {
+ if (container_delegate->IsInStatusContainer(target)) {
+ LOG(ERROR) << "JAMES ProcessPressedEvent hit status";
return;
}
}
@@ -84,14 +82,18 @@ void TrayEventFilter::ProcessLocatedEvent(
gfx::Rect bounds = bubble_widget->GetWindowBoundsInScreen();
bounds.Inset(wrapper->bubble_view()->GetBorderInsets());
- if (bounds.Contains(location_in_screen))
+ if (bounds.Contains(location_in_screen)) {
+ LOG(ERROR) << "JAMES clicked in bubble widget";
return;
+ }
if (wrapper->tray()) {
// If the user clicks on the parent tray, don't process the event here,
// let the tray logic handle the event and determine show/hide behavior.
bounds = wrapper->tray()->GetBoundsInScreen();
- if (bounds.Contains(location_in_screen))
+ if (bounds.Contains(location_in_screen)) {
+ LOG(ERROR) << "JAMES click on parent tray";
return;
+ }
}
}
@@ -105,6 +107,7 @@ void TrayEventFilter::ProcessLocatedEvent(
}
for (std::set<TrayBackgroundView*>::iterator iter = trays.begin();
iter != trays.end(); ++iter) {
+ LOG(ERROR) << "JAMES ClickedOutsideBubble";
(*iter)->ClickedOutsideBubble();
}
}
« no previous file with comments | « ash/system/tray/tray_event_filter.h ('k') | ash/test/test_shell_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698