Chromium Code Reviews| 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" |
| 11 #include "ui/views/bubble/bubble_delegate.h" | 11 #include "ui/views/bubble/bubble_delegate.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 class NotificationDetails; | 14 class NotificationDetails; |
| 15 class NotificationSource; | 15 class NotificationSource; |
| 16 class WebContents; | 16 class WebContents; |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 // Base class for bubbles that are shown from location bar icons. The bubble | 19 // 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 | 20 // will automatically close when the browser transitions in or out of fullscreen |
| 21 // mode. | 21 // mode. |
| 22 class LocationBarBubbleDelegateView : public views::BubbleDelegateView, | 22 class LocationBarBubbleDelegateView : public views::BubbleDelegateView, |
| 23 public content::NotificationObserver { | 23 public content::NotificationObserver { |
| 24 public: | 24 public: |
| 25 enum DisplayReason { AUTOMATIC, USER_ACTION }; | |
|
Peter Kasting
2015/11/10 00:24:18
I'm not opposed to adding this, but it seems like
Evan Stade
2015/11/10 19:18:26
Done, but I left the enum value as USER_GESTURE to
| |
| 26 | |
| 25 LocationBarBubbleDelegateView(views::View* anchor_view, | 27 LocationBarBubbleDelegateView(views::View* anchor_view, |
| 26 content::WebContents* web_contents); | 28 content::WebContents* web_contents); |
| 27 ~LocationBarBubbleDelegateView() override; | 29 ~LocationBarBubbleDelegateView() override; |
| 28 | 30 |
| 31 // Displays the bubble as a result of |reason|. | |
|
Peter Kasting
2015/11/10 00:24:18
You might want to note what we do differently in t
Evan Stade
2015/11/10 19:18:26
I don't like writing this type of comment because
| |
| 32 void ShowForReason(DisplayReason reason); | |
| 33 | |
| 29 // content::NotificationObserver: | 34 // content::NotificationObserver: |
| 30 void Observe(int type, | 35 void Observe(int type, |
| 31 const content::NotificationSource& source, | 36 const content::NotificationSource& source, |
| 32 const content::NotificationDetails& details) override; | 37 const content::NotificationDetails& details) override; |
| 33 | 38 |
| 34 protected: | 39 protected: |
| 35 // Closes the bubble. | 40 // Closes the bubble. |
| 36 virtual void Close(); | 41 virtual void Close(); |
| 37 | 42 |
| 38 // If the bubble is not anchored to a view, places the bubble in the top right | 43 // If the bubble is not anchored to a view, places the bubble in the top right |
| 39 // (left in RTL) of the |screen_bounds| that contain web contents's browser | 44 // (left in RTL) of the |screen_bounds| that contain web contents's browser |
| 40 // window. Because the positioning is based on the size of the bubble, this | 45 // window. Because the positioning is based on the size of the bubble, this |
| 41 // must be called after the bubble is created. | 46 // must be called after the bubble is created. |
| 42 void AdjustForFullscreen(const gfx::Rect& screen_bounds); | 47 void AdjustForFullscreen(const gfx::Rect& screen_bounds); |
| 43 | 48 |
| 44 private: | 49 private: |
| 45 // Used to register for fullscreen change notifications. | 50 // Used to register for fullscreen change notifications. |
| 46 content::NotificationRegistrar registrar_; | 51 content::NotificationRegistrar registrar_; |
| 47 | 52 |
| 48 DISALLOW_COPY_AND_ASSIGN(LocationBarBubbleDelegateView); | 53 DISALLOW_COPY_AND_ASSIGN(LocationBarBubbleDelegateView); |
| 49 }; | 54 }; |
| 50 | 55 |
| 51 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIE W_H_ | 56 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIE W_H_ |
| OLD | NEW |