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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // An image of the extension's icon, which appears in the zoom bubble as an | 70 // An image of the extension's icon, which appears in the zoom bubble as an |
71 // image button. | 71 // image button. |
72 scoped_ptr<const extensions::IconImage> icon_image; | 72 scoped_ptr<const extensions::IconImage> icon_image; |
73 }; | 73 }; |
74 | 74 |
75 ZoomBubbleView(views::View* anchor_view, | 75 ZoomBubbleView(views::View* anchor_view, |
76 content::WebContents* web_contents, | 76 content::WebContents* web_contents, |
77 bool auto_close, | 77 bool auto_close, |
78 ImmersiveModeController* immersive_mode_controller, | 78 ImmersiveModeController* immersive_mode_controller, |
79 FullscreenController* fullscreen_controller); | 79 FullscreenController* fullscreen_controller); |
80 virtual ~ZoomBubbleView(); | 80 ~ZoomBubbleView() override; |
81 | 81 |
82 // If the bubble is not anchored to a view, places the bubble in the top | 82 // If the bubble is not anchored to a view, places the bubble in the top |
83 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s | 83 // right (left in RTL) of the |screen_bounds| that contain |web_contents_|'s |
84 // browser window. Because the positioning is based on the size of the | 84 // browser window. Because the positioning is based on the size of the |
85 // bubble, this must be called after the bubble is created. | 85 // bubble, this must be called after the bubble is created. |
86 void AdjustForFullscreen(const gfx::Rect& screen_bounds); | 86 void AdjustForFullscreen(const gfx::Rect& screen_bounds); |
87 | 87 |
88 // Refreshes the bubble by changing the zoom percentage appropriately and | 88 // Refreshes the bubble by changing the zoom percentage appropriately and |
89 // resetting the timer if necessary. | 89 // resetting the timer if necessary. |
90 void Refresh(); | 90 void Refresh(); |
91 | 91 |
92 void Close(); | 92 void Close(); |
93 | 93 |
94 // Sets information about the extension that initiated the zoom change. | 94 // Sets information about the extension that initiated the zoom change. |
95 // Calling this method asserts that the extension |extension| did initiate | 95 // Calling this method asserts that the extension |extension| did initiate |
96 // the zoom change. | 96 // the zoom change. |
97 void SetExtensionInfo(const extensions::Extension* extension); | 97 void SetExtensionInfo(const extensions::Extension* extension); |
98 | 98 |
99 // Starts a timer which will close the bubble if |auto_close_| is true. | 99 // Starts a timer which will close the bubble if |auto_close_| is true. |
100 void StartTimerIfNecessary(); | 100 void StartTimerIfNecessary(); |
101 | 101 |
102 // Stops the auto-close timer. | 102 // Stops the auto-close timer. |
103 void StopTimer(); | 103 void StopTimer(); |
104 | 104 |
105 // extensions::IconImage::Observer overrides: | 105 // extensions::IconImage::Observer overrides: |
106 virtual void OnExtensionIconImageChanged( | 106 void OnExtensionIconImageChanged(extensions::IconImage* /* image */) override; |
107 extensions::IconImage* /* image */) override; | |
108 | 107 |
109 // views::View methods. | 108 // views::View methods. |
110 virtual void OnMouseEntered(const ui::MouseEvent& event) override; | 109 void OnMouseEntered(const ui::MouseEvent& event) override; |
111 virtual void OnMouseExited(const ui::MouseEvent& event) override; | 110 void OnMouseExited(const ui::MouseEvent& event) override; |
112 | 111 |
113 // ui::EventHandler method. | 112 // ui::EventHandler method. |
114 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 113 void OnGestureEvent(ui::GestureEvent* event) override; |
115 | 114 |
116 // views::ButtonListener method. | 115 // views::ButtonListener method. |
117 virtual void ButtonPressed(views::Button* sender, | 116 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
118 const ui::Event& event) override; | |
119 | 117 |
120 // views::BubbleDelegateView method. | 118 // views::BubbleDelegateView method. |
121 virtual void Init() override; | 119 void Init() override; |
122 virtual void WindowClosing() override; | 120 void WindowClosing() override; |
123 | 121 |
124 // content::NotificationObserver method. | 122 // content::NotificationObserver method. |
125 virtual void Observe(int type, | 123 void Observe(int type, |
126 const content::NotificationSource& source, | 124 const content::NotificationSource& source, |
127 const content::NotificationDetails& details) override; | 125 const content::NotificationDetails& details) override; |
128 | 126 |
129 // ImmersiveModeController::Observer methods. | 127 // ImmersiveModeController::Observer methods. |
130 virtual void OnImmersiveRevealStarted() override; | 128 void OnImmersiveRevealStarted() override; |
131 virtual void OnImmersiveModeControllerDestroyed() override; | 129 void OnImmersiveModeControllerDestroyed() override; |
132 | 130 |
133 ZoomBubbleExtensionInfo extension_info_; | 131 ZoomBubbleExtensionInfo extension_info_; |
134 | 132 |
135 // Singleton instance of the zoom bubble. The zoom bubble can only be shown on | 133 // Singleton instance of the zoom bubble. The zoom bubble can only be shown on |
136 // the active browser window, so there is no case in which it will be shown | 134 // the active browser window, so there is no case in which it will be shown |
137 // twice at the same time. | 135 // twice at the same time. |
138 static ZoomBubbleView* zoom_bubble_; | 136 static ZoomBubbleView* zoom_bubble_; |
139 | 137 |
140 // Timer used to close the bubble when |auto_close_| is true. | 138 // Timer used to close the bubble when |auto_close_| is true. |
141 base::OneShotTimer<ZoomBubbleView> timer_; | 139 base::OneShotTimer<ZoomBubbleView> timer_; |
(...skipping 17 matching lines...) Expand all Loading... |
159 // Not owned. | 157 // Not owned. |
160 ImmersiveModeController* immersive_mode_controller_; | 158 ImmersiveModeController* immersive_mode_controller_; |
161 | 159 |
162 // Used to register for fullscreen change notifications. | 160 // Used to register for fullscreen change notifications. |
163 content::NotificationRegistrar registrar_; | 161 content::NotificationRegistrar registrar_; |
164 | 162 |
165 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView); | 163 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView); |
166 }; | 164 }; |
167 | 165 |
168 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ | 166 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ |
OLD | NEW |