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