Chromium Code Reviews| Index: chrome/browser/ui/views/location_bar/zoom_bubble_view.h |
| diff --git a/chrome/browser/ui/views/location_bar/zoom_bubble_view.h b/chrome/browser/ui/views/location_bar/zoom_bubble_view.h |
| index 0f1752c44aab0e2eafc93ffc72cbd34d79199496..1f347d37b5daea76281d90c1516eaf0e3f1ac99b 100644 |
| --- a/chrome/browser/ui/views/location_bar/zoom_bubble_view.h |
| +++ b/chrome/browser/ui/views/location_bar/zoom_bubble_view.h |
| @@ -9,6 +9,7 @@ |
| #include "base/gtest_prod_util.h" |
| #include "base/timer/timer.h" |
| #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| +#include "chrome/browser/ui/views/managed_full_screen_bubble_delegate_view.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| #include "extensions/browser/extension_icon_image.h" |
| @@ -29,9 +30,8 @@ class ImageButton; |
| } // namespace views |
| // View used to display the zoom percentage when it has changed. |
| -class ZoomBubbleView : public views::BubbleDelegateView, |
| +class ZoomBubbleView : public ManagedFullScreenBubbleDelegateView, |
| public views::ButtonListener, |
| - public content::NotificationObserver, |
| public ImmersiveModeController::Observer, |
| public extensions::IconImage::Observer { |
| public: |
| @@ -53,25 +53,6 @@ class ZoomBubbleView : public views::BubbleDelegateView, |
| private: |
| FRIEND_TEST_ALL_PREFIXES(ZoomBubbleBrowserTest, ImmersiveFullscreen); |
| - // Stores information about the extension that initiated the zoom change, if |
| - // any. |
| - struct ZoomBubbleExtensionInfo { |
| - ZoomBubbleExtensionInfo(); |
| - ~ZoomBubbleExtensionInfo(); |
| - |
| - // The unique id of the extension, which is used to find the correct |
| - // extension after clicking on the image button in the zoom bubble. |
| - std::string id; |
| - |
| - // The name of the extension, which appears in the tooltip of the image |
| - // button in the zoom bubble. |
| - std::string name; |
| - |
| - // An image of the extension's icon, which appears in the zoom bubble as an |
| - // image button. |
| - scoped_ptr<const extensions::IconImage> icon_image; |
| - }; |
| - |
| ZoomBubbleView(views::View* anchor_view, |
| content::WebContents* web_contents, |
| bool auto_close, |
| @@ -79,18 +60,35 @@ class ZoomBubbleView : public views::BubbleDelegateView, |
| FullscreenController* fullscreen_controller); |
| ~ZoomBubbleView() override; |
| - // If the bubble is not anchored to a view, places the bubble in the top |
| - // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s |
| - // browser window. Because the positioning is based on the size of the |
| - // bubble, this must be called after the bubble is created. |
| - void AdjustForFullscreen(const gfx::Rect& screen_bounds); |
| + // views::View methods. |
|
Peter Kasting
2014/12/23 00:49:02
Since you're trying to clean this stuff up anyway,
Pritam Nikam
2014/12/23 06:22:29
Done.
|
| + void OnMouseEntered(const ui::MouseEvent& event) override; |
| + void OnMouseExited(const ui::MouseEvent& event) override; |
| + |
| + // views::BubbleDelegateView method. |
| + void Init() override; |
| + void WindowClosing() override; |
| + |
| + // ManagedFullScreenBubbleDelegateView: |
| + using ManagedFullScreenBubbleDelegateView::AdjustForFullscreen; |
|
Peter Kasting
2014/12/23 00:49:02
Don't do this, just make the method public in the
Pritam Nikam
2014/12/23 06:22:29
Done.
|
| + void Close() override; |
| + |
| + // ui::EventHandler method. |
| + void OnGestureEvent(ui::GestureEvent* event) override; |
| + |
| + // views::ButtonListener method. |
| + void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| + |
| + // ImmersiveModeController::Observer methods. |
| + void OnImmersiveRevealStarted() override; |
| + void OnImmersiveModeControllerDestroyed() override; |
| + |
| + // extensions::IconImage::Observer overrides: |
| + void OnExtensionIconImageChanged(extensions::IconImage* /* image */) override; |
| // Refreshes the bubble by changing the zoom percentage appropriately and |
| // resetting the timer if necessary. |
| void Refresh(); |
| - void Close(); |
| - |
| // Sets information about the extension that initiated the zoom change. |
| // Calling this method asserts that the extension |extension| did initiate |
| // the zoom change. |
| @@ -102,31 +100,24 @@ class ZoomBubbleView : public views::BubbleDelegateView, |
| // Stops the auto-close timer. |
| void StopTimer(); |
| - // extensions::IconImage::Observer overrides: |
| - void OnExtensionIconImageChanged(extensions::IconImage* /* image */) override; |
| - |
| - // views::View methods. |
| - void OnMouseEntered(const ui::MouseEvent& event) override; |
| - void OnMouseExited(const ui::MouseEvent& event) override; |
| - |
| - // ui::EventHandler method. |
| - void OnGestureEvent(ui::GestureEvent* event) override; |
| - |
| - // views::ButtonListener method. |
| - void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| + // Stores information about the extension that initiated the zoom change, if |
| + // any. |
| + struct ZoomBubbleExtensionInfo { |
|
Peter Kasting
2014/12/23 00:49:02
Member structs/classes should probably go above me
Pritam Nikam
2014/12/23 06:22:29
Done.
|
| + ZoomBubbleExtensionInfo(); |
| + ~ZoomBubbleExtensionInfo(); |
| - // views::BubbleDelegateView method. |
| - void Init() override; |
| - void WindowClosing() override; |
| + // The unique id of the extension, which is used to find the correct |
| + // extension after clicking on the image button in the zoom bubble. |
| + std::string id; |
| - // content::NotificationObserver method. |
| - void Observe(int type, |
| - const content::NotificationSource& source, |
| - const content::NotificationDetails& details) override; |
| + // The name of the extension, which appears in the tooltip of the image |
| + // button in the zoom bubble. |
| + std::string name; |
| - // ImmersiveModeController::Observer methods. |
| - void OnImmersiveRevealStarted() override; |
| - void OnImmersiveModeControllerDestroyed() override; |
| + // An image of the extension's icon, which appears in the zoom bubble as an |
| + // image button. |
| + scoped_ptr<const extensions::IconImage> icon_image; |
| + }; |
| ZoomBubbleExtensionInfo extension_info_; |
| @@ -157,9 +148,6 @@ class ZoomBubbleView : public views::BubbleDelegateView, |
| // Not owned. |
| ImmersiveModeController* immersive_mode_controller_; |
| - // Used to register for fullscreen change notifications. |
| - content::NotificationRegistrar registrar_; |
| - |
| DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView); |
| }; |