OLD | NEW |
---|---|
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" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 // location bar icon). | 28 // location bar icon). |
29 USER_GESTURE, | 29 USER_GESTURE, |
30 | 30 |
31 // The bubble appears spontaneously over the course of the user's | 31 // The bubble appears spontaneously over the course of the user's |
32 // interaction with Chrome (e.g. due to some change in the feature's | 32 // interaction with Chrome (e.g. due to some change in the feature's |
33 // status). | 33 // status). |
34 AUTOMATIC, | 34 AUTOMATIC, |
35 }; | 35 }; |
36 | 36 |
37 LocationBarBubbleDelegateView(views::View* anchor_view, | 37 LocationBarBubbleDelegateView(views::View* anchor_view, |
38 const gfx::Point& anchor_point, | |
39 views::BubbleBorder::Arrow arrow, | |
tapted
2017/04/12 05:08:42
Can we remove the |arrow| argument by calling
bub
varkha
2017/04/12 09:16:43
Done. And we don't center it on other platforms (w
| |
40 content::WebContents* web_contents); | |
41 LocationBarBubbleDelegateView(views::View* anchor_view, | |
38 content::WebContents* web_contents); | 42 content::WebContents* web_contents); |
39 ~LocationBarBubbleDelegateView() override; | 43 ~LocationBarBubbleDelegateView() override; |
40 | 44 |
41 // Displays the bubble with appearance and behavior tailored for |reason|. | 45 // Displays the bubble with appearance and behavior tailored for |reason|. |
42 void ShowForReason(DisplayReason reason); | 46 void ShowForReason(DisplayReason reason); |
43 | 47 |
44 // views::BubbleDialogDelegateView: | 48 // views::BubbleDialogDelegateView: |
45 int GetDialogButtons() const override; | 49 int GetDialogButtons() const override; |
46 | 50 |
47 // content::NotificationObserver: | 51 // content::NotificationObserver: |
(...skipping 16 matching lines...) Expand all Loading... | |
64 void OnTouchEvent(ui::TouchEvent* event) override; | 68 void OnTouchEvent(ui::TouchEvent* event) override; |
65 | 69 |
66 private: | 70 private: |
67 LocationBarBubbleDelegateView* bubble_; | 71 LocationBarBubbleDelegateView* bubble_; |
68 content::WebContents* web_contents_; | 72 content::WebContents* web_contents_; |
69 std::unique_ptr<views::EventMonitor> event_monitor_; | 73 std::unique_ptr<views::EventMonitor> event_monitor_; |
70 | 74 |
71 DISALLOW_COPY_AND_ASSIGN(WebContentMouseHandler); | 75 DISALLOW_COPY_AND_ASSIGN(WebContentMouseHandler); |
72 }; | 76 }; |
73 | 77 |
78 // Sets up the bubble anchoring to |anchor_view|. | |
79 // Uses |anchor_point| and |arrow| type when |anchor_view| is nullptr. | |
80 void SetupAnchor(views::View* anchor_view, | |
81 const gfx::Point& anchor_point, | |
82 views::BubbleBorder::Arrow arrow, | |
83 content::WebContents* web_contents); | |
84 | |
74 // Closes the bubble. | 85 // Closes the bubble. |
75 virtual void CloseBubble(); | 86 virtual void CloseBubble(); |
76 | 87 |
77 // If the bubble is not anchored to a view, places the bubble in the top right | 88 // If the bubble is not anchored to a view, places the bubble in the top right |
78 // (left in RTL) of the |screen_bounds| that contain web contents's browser | 89 // (left in RTL) of the |screen_bounds| that contain web contents's browser |
79 // window. Because the positioning is based on the size of the bubble, this | 90 // window. Because the positioning is based on the size of the bubble, this |
80 // must be called after the bubble is created. | 91 // must be called after the bubble is created. |
81 void AdjustForFullscreen(const gfx::Rect& screen_bounds); | 92 void AdjustForFullscreen(const gfx::Rect& screen_bounds); |
82 | 93 |
83 private: | 94 private: |
84 // Used to register for fullscreen change notifications. | 95 // Used to register for fullscreen change notifications. |
85 content::NotificationRegistrar registrar_; | 96 content::NotificationRegistrar registrar_; |
86 | 97 |
87 DISALLOW_COPY_AND_ASSIGN(LocationBarBubbleDelegateView); | 98 DISALLOW_COPY_AND_ASSIGN(LocationBarBubbleDelegateView); |
88 }; | 99 }; |
89 | 100 |
90 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIE W_H_ | 101 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIE W_H_ |
OLD | NEW |