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 19 matching lines...) Expand all Loading... |
30 class EVBubbleDecoration; | 30 class EVBubbleDecoration; |
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 StarDecoration; | 38 class StarDecoration; |
39 class ToolbarModel; | 39 class ToolbarModel; |
| 40 class ZoomDecoration; |
40 | 41 |
41 // A C++ bridge class that represents the location bar UI element to | 42 // A C++ bridge class that represents the location bar UI element to |
42 // the portable code. Wires up an OmniboxViewMac instance to | 43 // the portable code. Wires up an OmniboxViewMac instance to |
43 // the location bar text field, which handles most of the work. | 44 // the location bar text field, which handles most of the work. |
44 | 45 |
45 class LocationBarViewMac : public LocationBar, | 46 class LocationBarViewMac : public LocationBar, |
46 public LocationBarTesting, | 47 public LocationBarTesting, |
47 public OmniboxEditController, | 48 public OmniboxEditController, |
48 public content::NotificationObserver, | 49 public content::NotificationObserver, |
49 public CommandObserver { | 50 public CommandObserver { |
(...skipping 35 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| is |
| 97 // false when the change in zoom for the active tab wasn't an explicit user |
| 98 // action (e.g. switching tabs, creating a new tab, creating a new browser). |
| 99 // Additionally, |can_show_bubble| will only be true when the bubble wouldn't |
| 100 // be obscured by other UI (wrench menu) or redundant (+/- from wrench). |
| 101 void ZoomChangedForActiveTab(bool can_show_bubble); |
| 102 |
95 // Get the point in window coordinates on the star for the bookmark bubble to | 103 // Get the point in window coordinates on the star for the bookmark bubble to |
96 // aim at. | 104 // aim at. |
97 NSPoint GetBookmarkBubblePoint() const; | 105 NSPoint GetBookmarkBubblePoint() const; |
98 | 106 |
99 // Get the point in window coordinates on the Chrome To Mobile icon for | 107 // Get the point in window coordinates on the Chrome To Mobile icon for |
100 // anchoring its bubble. | 108 // anchoring its bubble. |
101 NSPoint GetChromeToMobileBubblePoint() const; | 109 NSPoint GetChromeToMobileBubblePoint() const; |
102 | 110 |
103 // Get the point in window coordinates in the security icon at which the page | 111 // Get the point in window coordinates in the security icon at which the page |
104 // info bubble aims. | 112 // info bubble aims. |
105 NSPoint GetPageInfoBubblePoint() const; | 113 NSPoint GetPageInfoBubblePoint() const; |
106 | 114 |
| 115 // When any image decorations change, call this to ensure everything is |
| 116 // redrawn and laid out if necessary. |
| 117 void OnDecorationsChanged(); |
| 118 |
107 // Updates the location bar. Resets the bar's permanent text and | 119 // Updates the location bar. Resets the bar's permanent text and |
108 // security style, and if |should_restore_state| is true, restores | 120 // security style, and if |should_restore_state| is true, restores |
109 // saved state from the tab (for tab switching). | 121 // saved state from the tab (for tab switching). |
110 void Update(const content::WebContents* tab, bool should_restore_state); | 122 void Update(const content::WebContents* tab, bool should_restore_state); |
111 | 123 |
112 // Layout the various decorations which live in the field. | 124 // Layout the various decorations which live in the field. |
113 void Layout(); | 125 void Layout(); |
114 | 126 |
115 // Re-draws |decoration| if it's already being displayed. | 127 // Re-draws |decoration| if it's already being displayed. |
116 void RedrawDecoration(LocationBarDecoration* decoration); | 128 void RedrawDecoration(LocationBarDecoration* decoration); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 bool RefreshContentSettingsDecorations(); | 201 bool RefreshContentSettingsDecorations(); |
190 | 202 |
191 void ShowFirstRunBubbleInternal(); | 203 void ShowFirstRunBubbleInternal(); |
192 | 204 |
193 // Checks if the bookmark star should be enabled or not. | 205 // Checks if the bookmark star should be enabled or not. |
194 bool IsStarEnabled(); | 206 bool IsStarEnabled(); |
195 | 207 |
196 // Update the Chrome To Mobile page action visibility and command state. | 208 // Update the Chrome To Mobile page action visibility and command state. |
197 void UpdateChromeToMobileEnabled(); | 209 void UpdateChromeToMobileEnabled(); |
198 | 210 |
| 211 // Updates the zoom decoration in the omnibox with the current zoom level. |
| 212 void UpdateZoomDecoration(); |
| 213 |
199 scoped_ptr<OmniboxViewMac> omnibox_view_; | 214 scoped_ptr<OmniboxViewMac> omnibox_view_; |
200 | 215 |
201 CommandUpdater* command_updater_; // Weak, owned by Browser. | 216 CommandUpdater* command_updater_; // Weak, owned by Browser. |
202 | 217 |
203 AutocompleteTextField* field_; // owned by tab controller | 218 AutocompleteTextField* field_; // owned by tab controller |
204 | 219 |
205 // When we get an OnAutocompleteAccept notification from the autocomplete | 220 // When we get an OnAutocompleteAccept notification from the autocomplete |
206 // edit, we save the input string so we can give it back to the browser on | 221 // edit, we save the input string so we can give it back to the browser on |
207 // the LocationBar interface via GetInputString(). | 222 // the LocationBar interface via GetInputString(). |
208 string16 location_input_; | 223 string16 location_input_; |
(...skipping 13 matching lines...) Expand all Loading... |
222 | 237 |
223 // Action "plus" button right of bookmark star. | 238 // Action "plus" button right of bookmark star. |
224 scoped_ptr<PlusDecoration> plus_decoration_; | 239 scoped_ptr<PlusDecoration> plus_decoration_; |
225 | 240 |
226 // Bookmark star right of page actions. | 241 // Bookmark star right of page actions. |
227 scoped_ptr<StarDecoration> star_decoration_; | 242 scoped_ptr<StarDecoration> star_decoration_; |
228 | 243 |
229 // Chrome To Mobile page action icon. | 244 // Chrome To Mobile page action icon. |
230 scoped_ptr<ChromeToMobileDecoration> chrome_to_mobile_decoration_; | 245 scoped_ptr<ChromeToMobileDecoration> chrome_to_mobile_decoration_; |
231 | 246 |
| 247 // A zoom icon at the end of the omnibox, which shows at non-standard zoom |
| 248 // levels. |
| 249 scoped_ptr<ZoomDecoration> zoom_decoration_; |
| 250 |
232 // The installed page actions. | 251 // The installed page actions. |
233 std::vector<ExtensionAction*> page_actions_; | 252 std::vector<ExtensionAction*> page_actions_; |
234 | 253 |
235 // Decorations for the installed Page Actions. | 254 // Decorations for the installed Page Actions. |
236 ScopedVector<PageActionDecoration> page_action_decorations_; | 255 ScopedVector<PageActionDecoration> page_action_decorations_; |
237 | 256 |
238 // The content blocked decorations. | 257 // The content blocked decorations. |
239 ScopedVector<ContentSettingDecoration> content_setting_decorations_; | 258 ScopedVector<ContentSettingDecoration> content_setting_decorations_; |
240 | 259 |
241 // Keyword hint decoration displayed on the right-hand side. | 260 // Keyword hint decoration displayed on the right-hand side. |
(...skipping 14 matching lines...) Expand all Loading... |
256 // Used to schedule a task for the first run info bubble. | 275 // Used to schedule a task for the first run info bubble. |
257 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; | 276 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; |
258 | 277 |
259 // Used to change the visibility of the star decoration. | 278 // Used to change the visibility of the star decoration. |
260 BooleanPrefMember edit_bookmarks_enabled_; | 279 BooleanPrefMember edit_bookmarks_enabled_; |
261 | 280 |
262 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 281 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
263 }; | 282 }; |
264 | 283 |
265 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 284 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
OLD | NEW |