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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc

Issue 2074913002: Enable the translate bubble to be dismissed when user ignores it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc b/chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc
index 85172f1b2ef95af5fa6284195bb6609489d281cb..3ace6d80e6b62c3c292ac3b59a23832c5b93c5e7 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc
@@ -10,9 +10,43 @@
#include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
#include "chrome/browser/ui/layout_constants.h"
#include "content/public/browser/notification_source.h"
+#include "content/public/browser/render_view_host.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/gfx/geometry/rect.h"
+LocationBarBubbleDelegateView::WebContentMouseHandler::WebContentMouseHandler(
+ LocationBarBubbleDelegateView* bubble,
+ content::WebContents* web_contents)
+ : bubble_(bubble), web_contents_(web_contents) {
+ DCHECK(bubble_);
+ DCHECK(web_contents_);
+ event_monitor_ = views::EventMonitor::CreateWindowMonitor(
+ this, web_contents_->GetTopLevelNativeWindow());
+}
+
+LocationBarBubbleDelegateView::WebContentMouseHandler::
+ ~WebContentMouseHandler() {}
+
+void LocationBarBubbleDelegateView::WebContentMouseHandler::OnKeyEvent(
+ ui::KeyEvent* event) {
+ if ((event->key_code() == ui::VKEY_ESCAPE ||
+ web_contents_->GetRenderViewHost()->IsFocusedElementEditable()) &&
+ event->type() == ui::ET_KEY_PRESSED)
+ bubble_->CloseBubble();
+}
+
+void LocationBarBubbleDelegateView::WebContentMouseHandler::OnMouseEvent(
+ ui::MouseEvent* event) {
+ if (event->type() == ui::ET_MOUSE_PRESSED)
+ bubble_->CloseBubble();
+}
+
+void LocationBarBubbleDelegateView::WebContentMouseHandler::OnTouchEvent(
+ ui::TouchEvent* event) {
+ if (event->type() == ui::ET_TOUCH_PRESSED)
+ bubble_->CloseBubble();
+}
+
LocationBarBubbleDelegateView::LocationBarBubbleDelegateView(
views::View* anchor_view,
content::WebContents* web_contents)

Powered by Google App Engine
This is Rietveld 408576698