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| 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 OnImageDecorationsChanged(); |
| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 bool RefreshContentSettingsDecorations(); | 198 bool RefreshContentSettingsDecorations(); |
187 | 199 |
188 void ShowFirstRunBubbleInternal(); | 200 void ShowFirstRunBubbleInternal(); |
189 | 201 |
190 // Checks if the bookmark star should be enabled or not. | 202 // Checks if the bookmark star should be enabled or not. |
191 bool IsStarEnabled(); | 203 bool IsStarEnabled(); |
192 | 204 |
193 // Update the Chrome To Mobile page action visibility and command state. | 205 // Update the Chrome To Mobile page action visibility and command state. |
194 void UpdateChromeToMobileEnabled(); | 206 void UpdateChromeToMobileEnabled(); |
195 | 207 |
| 208 // Updates the zoom decoration in the omnibox with the current zoom level. |
| 209 void UpdateZoomDecoration(); |
| 210 |
196 scoped_ptr<OmniboxViewMac> omnibox_view_; | 211 scoped_ptr<OmniboxViewMac> omnibox_view_; |
197 | 212 |
198 CommandUpdater* command_updater_; // Weak, owned by Browser. | 213 CommandUpdater* command_updater_; // Weak, owned by Browser. |
199 | 214 |
200 AutocompleteTextField* field_; // owned by tab controller | 215 AutocompleteTextField* field_; // owned by tab controller |
201 | 216 |
202 // When we get an OnAutocompleteAccept notification from the autocomplete | 217 // 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 | 218 // edit, we save the input string so we can give it back to the browser on |
204 // the LocationBar interface via GetInputString(). | 219 // the LocationBar interface via GetInputString(). |
205 string16 location_input_; | 220 string16 location_input_; |
(...skipping 13 matching lines...) Expand all Loading... |
219 | 234 |
220 // Action "plus" button right of bookmark star. | 235 // Action "plus" button right of bookmark star. |
221 scoped_ptr<PlusDecoration> plus_decoration_; | 236 scoped_ptr<PlusDecoration> plus_decoration_; |
222 | 237 |
223 // Bookmark star right of page actions. | 238 // Bookmark star right of page actions. |
224 scoped_ptr<StarDecoration> star_decoration_; | 239 scoped_ptr<StarDecoration> star_decoration_; |
225 | 240 |
226 // Chrome To Mobile page action icon. | 241 // Chrome To Mobile page action icon. |
227 scoped_ptr<ChromeToMobileDecoration> chrome_to_mobile_decoration_; | 242 scoped_ptr<ChromeToMobileDecoration> chrome_to_mobile_decoration_; |
228 | 243 |
| 244 // A zoom icon at the end of the omnibox, which shows at non-standard zoom |
| 245 // levels. |
| 246 scoped_ptr<ZoomDecoration> zoom_decoration_; |
| 247 |
229 // The installed page actions. | 248 // The installed page actions. |
230 std::vector<ExtensionAction*> page_actions_; | 249 std::vector<ExtensionAction*> page_actions_; |
231 | 250 |
232 // Decorations for the installed Page Actions. | 251 // Decorations for the installed Page Actions. |
233 ScopedVector<PageActionDecoration> page_action_decorations_; | 252 ScopedVector<PageActionDecoration> page_action_decorations_; |
234 | 253 |
235 // The content blocked decorations. | 254 // The content blocked decorations. |
236 ScopedVector<ContentSettingDecoration> content_setting_decorations_; | 255 ScopedVector<ContentSettingDecoration> content_setting_decorations_; |
237 | 256 |
238 // Keyword hint decoration displayed on the right-hand side. | 257 // 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. | 272 // Used to schedule a task for the first run info bubble. |
254 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; | 273 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; |
255 | 274 |
256 // Used to change the visibility of the star decoration. | 275 // Used to change the visibility of the star decoration. |
257 BooleanPrefMember edit_bookmarks_enabled_; | 276 BooleanPrefMember edit_bookmarks_enabled_; |
258 | 277 |
259 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 278 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
260 }; | 279 }; |
261 | 280 |
262 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 281 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
OLD | NEW |