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

Unified Diff: ash/shelf/overflow_bubble.cc

Issue 1934123004: mash: Fix shelf overflow bubble not closing on click outside its bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2openoverflow
Patch Set: Created 4 years, 8 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/shelf/overflow_bubble.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/overflow_bubble.cc
diff --git a/ash/shelf/overflow_bubble.cc b/ash/shelf/overflow_bubble.cc
index 19f460cf5fe298630fbe5eaf71141794f3cb3204..cf3dc33cdfdf63fe4bc40c0ab9e9a8e16c4f6568 100644
--- a/ash/shelf/overflow_bubble.cc
+++ b/ash/shelf/overflow_bubble.cc
@@ -11,7 +11,6 @@
#include "ash/shell.h"
#include "ash/system/tray/tray_background_view.h"
#include "ui/aura/client/screen_position_client.h"
-#include "ui/aura/window_event_dispatcher.h"
#include "ui/events/event.h"
#include "ui/views/widget/widget.h"
@@ -35,8 +34,7 @@ void OverflowBubble::Show(views::View* anchor, ShelfView* shelf_view) {
shelf_view_ = shelf_view;
anchor_ = anchor;
- // TODO(jamescook): Change this to a PointerWatcher.
- Shell::GetInstance()->AddPreTargetHandler(this);
+ Shell::GetInstance()->AddPointerWatcher(this);
TrayBackgroundView::InitializeBubbleAnimations(bubble_->GetWidget());
bubble_->GetWidget()->AddObserver(this);
@@ -47,7 +45,7 @@ void OverflowBubble::Hide() {
if (!IsShowing())
return;
- Shell::GetInstance()->RemovePreTargetHandler(this);
+ Shell::GetInstance()->RemovePointerWatcher(this);
bubble_->GetWidget()->RemoveObserver(this);
bubble_->GetWidget()->Close();
bubble_ = NULL;
@@ -66,11 +64,11 @@ void OverflowBubble::HideBubbleAndRefreshButton() {
anchor->SchedulePaint();
}
-void OverflowBubble::ProcessPressedEvent(ui::LocatedEvent* event) {
- aura::Window* target = static_cast<aura::Window*>(event->target());
- gfx::Point event_location_in_screen = event->location();
- aura::client::GetScreenPositionClient(target->GetRootWindow())->
- ConvertPointToScreen(target, &event_location_in_screen);
+void OverflowBubble::ProcessPressedEvent(const ui::LocatedEvent& event) {
+ aura::Window* root = bubble_->GetWidget()->GetNativeWindow()->GetRootWindow();
+ gfx::Point event_location_in_screen = event.root_location();
+ aura::client::GetScreenPositionClient(root)->ConvertPointToScreen(
msw 2016/05/02 17:18:13 Will this work? What is the coordinate system used
James Cook 2016/05/02 17:48:34 Yes, I think this is wrong for multi-display. Good
+ root, &event_location_in_screen);
if (!shelf_view_->IsShowingMenu() &&
!bubble_->GetBoundsInScreen().Contains(event_location_in_screen) &&
!anchor_->GetBoundsInScreen().Contains(event_location_in_screen)) {
@@ -78,14 +76,12 @@ void OverflowBubble::ProcessPressedEvent(ui::LocatedEvent* event) {
}
}
-void OverflowBubble::OnMouseEvent(ui::MouseEvent* event) {
- if (event->type() == ui::ET_MOUSE_PRESSED)
- ProcessPressedEvent(event);
+void OverflowBubble::OnMousePressed(const ui::MouseEvent& event) {
+ ProcessPressedEvent(event);
}
-void OverflowBubble::OnTouchEvent(ui::TouchEvent* event) {
- if (event->type() == ui::ET_TOUCH_PRESSED)
- ProcessPressedEvent(event);
+void OverflowBubble::OnTouchPressed(const ui::TouchEvent& event) {
+ ProcessPressedEvent(event);
}
void OverflowBubble::OnWidgetDestroying(views::Widget* widget) {
« no previous file with comments | « ash/shelf/overflow_bubble.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698