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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.h

Issue 2061523002: Enable the translate bubble to be dismissed when user ignores it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIEW_H _ 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIEW_H _
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIEW_H _ 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIEW_H _
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "content/public/browser/notification_observer.h" 9 #include "content/public/browser/notification_observer.h"
10 #include "content/public/browser/notification_registrar.h" 10 #include "content/public/browser/notification_registrar.h"
11 #include "ui/views/bubble/bubble_dialog_delegate.h" 11 #include "ui/views/bubble/bubble_dialog_delegate.h"
12 #include "ui/views/event_monitor.h"
12 13
13 namespace content { 14 namespace content {
14 class NotificationDetails; 15 class NotificationDetails;
15 class NotificationSource; 16 class NotificationSource;
16 class WebContents; 17 class WebContents;
17 }; 18 };
18 19
19 // Base class for bubbles that are shown from location bar icons. The bubble 20 // Base class for bubbles that are shown from location bar icons. The bubble
20 // will automatically close when the browser transitions in or out of fullscreen 21 // will automatically close when the browser transitions in or out of fullscreen
21 // mode. 22 // mode.
(...skipping 20 matching lines...) Expand all
42 43
43 // views::BubbleDialogDelegateView: 44 // views::BubbleDialogDelegateView:
44 int GetDialogButtons() const override; 45 int GetDialogButtons() const override;
45 46
46 // content::NotificationObserver: 47 // content::NotificationObserver:
47 void Observe(int type, 48 void Observe(int type,
48 const content::NotificationSource& source, 49 const content::NotificationSource& source,
49 const content::NotificationDetails& details) override; 50 const content::NotificationDetails& details) override;
50 51
51 protected: 52 protected:
53 // The class listens for WebContentsView events and closes the bubble. Useful
54 // for bubbles that do not start out focused but need to close when the user
55 // interacts with the web view.
56 class WebContentMouseHandler : public ui::EventHandler {
57 public:
58 WebContentMouseHandler(LocationBarBubbleDelegateView* bubble,
59 content::WebContents* web_contents);
60 ~WebContentMouseHandler() override;
61
62 void OnKeyEvent(ui::KeyEvent* event) override;
63 void OnMouseEvent(ui::MouseEvent* event) override;
64 void OnTouchEvent(ui::TouchEvent* event) override;
65
66 private:
67 LocationBarBubbleDelegateView* bubble_;
68 content::WebContents* web_contents_;
69 std::unique_ptr<views::EventMonitor> event_monitor_;
70
71 DISALLOW_COPY_AND_ASSIGN(WebContentMouseHandler);
72 };
73
52 // Closes the bubble. 74 // Closes the bubble.
53 virtual void CloseBubble(); 75 virtual void CloseBubble();
54 76
55 // If the bubble is not anchored to a view, places the bubble in the top right 77 // If the bubble is not anchored to a view, places the bubble in the top right
56 // (left in RTL) of the |screen_bounds| that contain web contents's browser 78 // (left in RTL) of the |screen_bounds| that contain web contents's browser
57 // window. Because the positioning is based on the size of the bubble, this 79 // window. Because the positioning is based on the size of the bubble, this
58 // must be called after the bubble is created. 80 // must be called after the bubble is created.
59 void AdjustForFullscreen(const gfx::Rect& screen_bounds); 81 void AdjustForFullscreen(const gfx::Rect& screen_bounds);
60 82
61 private: 83 private:
62 // Used to register for fullscreen change notifications. 84 // Used to register for fullscreen change notifications.
63 content::NotificationRegistrar registrar_; 85 content::NotificationRegistrar registrar_;
64 86
65 DISALLOW_COPY_AND_ASSIGN(LocationBarBubbleDelegateView); 87 DISALLOW_COPY_AND_ASSIGN(LocationBarBubbleDelegateView);
66 }; 88 };
67 89
68 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIE W_H_ 90 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIE W_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698