| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ZOOM_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| 11 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 11 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 12 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" | 12 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" |
| 13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 15 #include "extensions/browser/extension_icon_image.h" | 15 #include "extensions/browser/extension_icon_image.h" |
| 16 #include "ui/views/controls/button/button.h" | 16 #include "ui/views/controls/button/image_button.h" |
| 17 #include "ui/views/controls/label.h" | 17 #include "ui/views/controls/label.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class WebContents; | 20 class WebContents; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace views { | |
| 24 class ImageButton; | |
| 25 } // namespace views | |
| 26 | |
| 27 // View used to display the zoom percentage when it has changed. | 23 // View used to display the zoom percentage when it has changed. |
| 28 class ZoomBubbleView : public LocationBarBubbleDelegateView, | 24 class ZoomBubbleView : public LocationBarBubbleDelegateView, |
| 29 public views::ButtonListener, | 25 public views::ImageButtonDelegate, |
| 30 public ImmersiveModeController::Observer, | 26 public ImmersiveModeController::Observer, |
| 31 public extensions::IconImage::Observer { | 27 public extensions::IconImage::Observer { |
| 32 public: | 28 public: |
| 33 // Shows the bubble and automatically closes it after a short time period if | 29 // Shows the bubble and automatically closes it after a short time period if |
| 34 // |reason| is AUTOMATIC. | 30 // |reason| is AUTOMATIC. |
| 35 static void ShowBubble(content::WebContents* web_contents, | 31 static void ShowBubble(content::WebContents* web_contents, |
| 36 DisplayReason reason); | 32 DisplayReason reason); |
| 37 | 33 |
| 38 // Closes the showing bubble (if one exists). | 34 // Closes the showing bubble (if one exists). |
| 39 static void CloseCurrentBubble(); | 35 static void CloseCurrentBubble(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 ~ZoomBubbleView() override; | 67 ~ZoomBubbleView() override; |
| 72 | 68 |
| 73 // LocationBarBubbleDelegateView: | 69 // LocationBarBubbleDelegateView: |
| 74 void OnGestureEvent(ui::GestureEvent* event) override; | 70 void OnGestureEvent(ui::GestureEvent* event) override; |
| 75 void OnMouseEntered(const ui::MouseEvent& event) override; | 71 void OnMouseEntered(const ui::MouseEvent& event) override; |
| 76 void OnMouseExited(const ui::MouseEvent& event) override; | 72 void OnMouseExited(const ui::MouseEvent& event) override; |
| 77 void Init() override; | 73 void Init() override; |
| 78 void WindowClosing() override; | 74 void WindowClosing() override; |
| 79 void CloseBubble() override; | 75 void CloseBubble() override; |
| 80 | 76 |
| 81 // views::ButtonListener: | 77 // views::ImageButtonDelegate: |
| 82 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 78 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 83 | 79 |
| 84 // ImmersiveModeController::Observer: | 80 // ImmersiveModeController::Observer: |
| 85 void OnImmersiveRevealStarted() override; | 81 void OnImmersiveRevealStarted() override; |
| 86 void OnImmersiveModeControllerDestroyed() override; | 82 void OnImmersiveModeControllerDestroyed() override; |
| 87 | 83 |
| 88 // extensions::IconImage::Observer: | 84 // extensions::IconImage::Observer: |
| 89 void OnExtensionIconImageChanged(extensions::IconImage* /* image */) override; | 85 void OnExtensionIconImageChanged(extensions::IconImage* /* image */) override; |
| 90 | 86 |
| 91 // Refreshes the bubble by changing the zoom percentage appropriately and | 87 // Refreshes the bubble by changing the zoom percentage appropriately and |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 125 |
| 130 // The immersive mode controller for the BrowserView containing | 126 // The immersive mode controller for the BrowserView containing |
| 131 // |web_contents_|. | 127 // |web_contents_|. |
| 132 // Not owned. | 128 // Not owned. |
| 133 ImmersiveModeController* immersive_mode_controller_; | 129 ImmersiveModeController* immersive_mode_controller_; |
| 134 | 130 |
| 135 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView); | 131 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView); |
| 136 }; | 132 }; |
| 137 | 133 |
| 138 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ | 134 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ |
| OLD | NEW |