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_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #import <Cocoa/Cocoa.h> | 10 #import <Cocoa/Cocoa.h> |
(...skipping 20 matching lines...) Expand all Loading... | |
31 class KeywordHintDecoration; | 31 class KeywordHintDecoration; |
32 class LocationBarDecoration; | 32 class LocationBarDecoration; |
33 class LocationIconDecoration; | 33 class LocationIconDecoration; |
34 class PageActionDecoration; | 34 class PageActionDecoration; |
35 class PlusDecoration; | 35 class PlusDecoration; |
36 class Profile; | 36 class Profile; |
37 class SelectedKeywordDecoration; | 37 class SelectedKeywordDecoration; |
38 class SkBitmap; | 38 class SkBitmap; |
39 class StarDecoration; | 39 class StarDecoration; |
40 class ToolbarModel; | 40 class ToolbarModel; |
41 class ZoomDecoration; | |
41 | 42 |
42 // A C++ bridge class that represents the location bar UI element to | 43 // A C++ bridge class that represents the location bar UI element to |
43 // the portable code. Wires up an OmniboxViewMac instance to | 44 // the portable code. Wires up an OmniboxViewMac instance to |
44 // the location bar text field, which handles most of the work. | 45 // the location bar text field, which handles most of the work. |
45 | 46 |
46 class LocationBarViewMac : public LocationBar, | 47 class LocationBarViewMac : public LocationBar, |
47 public LocationBarTesting, | 48 public LocationBarTesting, |
48 public OmniboxEditController, | 49 public OmniboxEditController, |
49 public content::NotificationObserver, | 50 public content::NotificationObserver, |
50 public CommandObserver { | 51 public CommandObserver { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 // Set/Get the editable state of the field. | 86 // Set/Get the editable state of the field. |
86 void SetEditable(bool editable); | 87 void SetEditable(bool editable); |
87 bool IsEditable(); | 88 bool IsEditable(); |
88 | 89 |
89 // Set the starred state of the bookmark star. | 90 // Set the starred state of the bookmark star. |
90 void SetStarred(bool starred); | 91 void SetStarred(bool starred); |
91 | 92 |
92 // Set ChromeToMobileDecoration's lit state (to update the icon). | 93 // Set ChromeToMobileDecoration's lit state (to update the icon). |
93 void SetChromeToMobileDecorationLit(bool lit); | 94 void SetChromeToMobileDecorationLit(bool lit); |
94 | 95 |
96 // Happens when the zoom changes for the active tab. |can_show_bubble| = true | |
97 // indicates it's worth showing a bubble over this change, where as | |
98 // |can_show_bubble| = false means it probably wasn't a very interesting | |
99 // change (e.g. switching tabs, creating a new tab, creating a new browser). | |
Kyle Horimoto
2012/07/24 03:22:28
Nit: Get rid of the ambiguous "interesting" vs. "n
Dan Beam
2012/08/15 09:04:59
Done.
| |
100 void ZoomChangedForActiveTab(bool can_show_bubble); | |
101 | |
95 // Get the point in window coordinates on the star for the bookmark bubble to | 102 // Get the point in window coordinates on the star for the bookmark bubble to |
96 // aim at. | 103 // aim at. |
97 NSPoint GetBookmarkBubblePoint() const; | 104 NSPoint GetBookmarkBubblePoint() const; |
98 | 105 |
99 // Get the point in window coordinates on the Chrome To Mobile icon for | 106 // Get the point in window coordinates on the Chrome To Mobile icon for |
100 // anchoring its bubble. | 107 // anchoring its bubble. |
101 NSPoint GetChromeToMobileBubblePoint() const; | 108 NSPoint GetChromeToMobileBubblePoint() const; |
102 | 109 |
103 // Get the point in window coordinates in the security icon at which the page | 110 // Get the point in window coordinates in the security icon at which the page |
104 // info bubble aims. | 111 // info bubble aims. |
105 NSPoint GetPageInfoBubblePoint() const; | 112 NSPoint GetPageInfoBubblePoint() const; |
106 | 113 |
114 // When any image decorations change, call this to ensure everything is | |
115 // redrawn and laid out if necessary. | |
116 void OnImageDecorationsChanged(); | |
117 | |
107 // Updates the location bar. Resets the bar's permanent text and | 118 // Updates the location bar. Resets the bar's permanent text and |
108 // security style, and if |should_restore_state| is true, restores | 119 // security style, and if |should_restore_state| is true, restores |
109 // saved state from the tab (for tab switching). | 120 // saved state from the tab (for tab switching). |
110 void Update(const content::WebContents* tab, bool should_restore_state); | 121 void Update(const content::WebContents* tab, bool should_restore_state); |
111 | 122 |
112 // Layout the various decorations which live in the field. | 123 // Layout the various decorations which live in the field. |
113 void Layout(); | 124 void Layout(); |
114 | 125 |
115 // Re-draws |decoration| if it's already being displayed. | 126 // Re-draws |decoration| if it's already being displayed. |
116 void RedrawDecoration(LocationBarDecoration* decoration); | 127 void RedrawDecoration(LocationBarDecoration* decoration); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 bool RefreshContentSettingsDecorations(); | 197 bool RefreshContentSettingsDecorations(); |
187 | 198 |
188 void ShowFirstRunBubbleInternal(); | 199 void ShowFirstRunBubbleInternal(); |
189 | 200 |
190 // Checks if the bookmark star should be enabled or not. | 201 // Checks if the bookmark star should be enabled or not. |
191 bool IsStarEnabled(); | 202 bool IsStarEnabled(); |
192 | 203 |
193 // Update the Chrome To Mobile page action visibility and command state. | 204 // Update the Chrome To Mobile page action visibility and command state. |
194 void UpdateChromeToMobileEnabled(); | 205 void UpdateChromeToMobileEnabled(); |
195 | 206 |
207 // Updates the zoom decoration in the omnibox with the current zoom level. | |
208 void UpdateZoomDecoration(); | |
209 | |
196 scoped_ptr<OmniboxViewMac> omnibox_view_; | 210 scoped_ptr<OmniboxViewMac> omnibox_view_; |
197 | 211 |
198 CommandUpdater* command_updater_; // Weak, owned by Browser. | 212 CommandUpdater* command_updater_; // Weak, owned by Browser. |
199 | 213 |
200 AutocompleteTextField* field_; // owned by tab controller | 214 AutocompleteTextField* field_; // owned by tab controller |
201 | 215 |
202 // When we get an OnAutocompleteAccept notification from the autocomplete | 216 // When we get an OnAutocompleteAccept notification from the autocomplete |
203 // edit, we save the input string so we can give it back to the browser on | 217 // edit, we save the input string so we can give it back to the browser on |
204 // the LocationBar interface via GetInputString(). | 218 // the LocationBar interface via GetInputString(). |
205 string16 location_input_; | 219 string16 location_input_; |
(...skipping 13 matching lines...) Expand all Loading... | |
219 | 233 |
220 // Action "plus" button right of bookmark star. | 234 // Action "plus" button right of bookmark star. |
221 scoped_ptr<PlusDecoration> plus_decoration_; | 235 scoped_ptr<PlusDecoration> plus_decoration_; |
222 | 236 |
223 // Bookmark star right of page actions. | 237 // Bookmark star right of page actions. |
224 scoped_ptr<StarDecoration> star_decoration_; | 238 scoped_ptr<StarDecoration> star_decoration_; |
225 | 239 |
226 // Chrome To Mobile page action icon. | 240 // Chrome To Mobile page action icon. |
227 scoped_ptr<ChromeToMobileDecoration> chrome_to_mobile_decoration_; | 241 scoped_ptr<ChromeToMobileDecoration> chrome_to_mobile_decoration_; |
228 | 242 |
243 // A zoom icon at the end of the omnibox, which shows at non-standard zoom | |
244 // levels. | |
245 scoped_ptr<ZoomDecoration> zoom_decoration_; | |
246 | |
229 // The installed page actions. | 247 // The installed page actions. |
230 std::vector<ExtensionAction*> page_actions_; | 248 std::vector<ExtensionAction*> page_actions_; |
231 | 249 |
232 // Decorations for the installed Page Actions. | 250 // Decorations for the installed Page Actions. |
233 ScopedVector<PageActionDecoration> page_action_decorations_; | 251 ScopedVector<PageActionDecoration> page_action_decorations_; |
234 | 252 |
235 // The content blocked decorations. | 253 // The content blocked decorations. |
236 ScopedVector<ContentSettingDecoration> content_setting_decorations_; | 254 ScopedVector<ContentSettingDecoration> content_setting_decorations_; |
237 | 255 |
238 // Keyword hint decoration displayed on the right-hand side. | 256 // Keyword hint decoration displayed on the right-hand side. |
(...skipping 14 matching lines...) Expand all Loading... | |
253 // Used to schedule a task for the first run info bubble. | 271 // Used to schedule a task for the first run info bubble. |
254 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; | 272 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; |
255 | 273 |
256 // Used to change the visibility of the star decoration. | 274 // Used to change the visibility of the star decoration. |
257 BooleanPrefMember edit_bookmarks_enabled_; | 275 BooleanPrefMember edit_bookmarks_enabled_; |
258 | 276 |
259 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 277 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
260 }; | 278 }; |
261 | 279 |
262 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 280 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
OLD | NEW |