| 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 17 matching lines...) Expand all Loading... |
| 28 class KeywordHintDecoration; | 28 class KeywordHintDecoration; |
| 29 class LocationBarDecoration; | 29 class LocationBarDecoration; |
| 30 class LocationIconDecoration; | 30 class LocationIconDecoration; |
| 31 class MicSearchDecoration; | 31 class MicSearchDecoration; |
| 32 class OriginChipDecoration; | 32 class OriginChipDecoration; |
| 33 class PageActionDecoration; | 33 class PageActionDecoration; |
| 34 class Profile; | 34 class Profile; |
| 35 class SearchButtonDecoration; | 35 class SearchButtonDecoration; |
| 36 class SelectedKeywordDecoration; | 36 class SelectedKeywordDecoration; |
| 37 class StarDecoration; | 37 class StarDecoration; |
| 38 class TranslateDecoration; |
| 38 class ZoomDecoration; | 39 class ZoomDecoration; |
| 39 class ZoomDecorationTest; | 40 class ZoomDecorationTest; |
| 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, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 virtual void TestPageActionPressed(size_t index) OVERRIDE; | 83 virtual void TestPageActionPressed(size_t index) OVERRIDE; |
| 83 virtual bool GetBookmarkStarVisibility() OVERRIDE; | 84 virtual bool GetBookmarkStarVisibility() OVERRIDE; |
| 84 | 85 |
| 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 |
| 93 // Set whether or not the translate icon is lit. |
| 94 void SetTranslateIconLit(bool on); |
| 95 |
| 92 // Happens when the zoom changes for the active tab. |can_show_bubble| is | 96 // Happens when the zoom changes for the active tab. |can_show_bubble| is |
| 93 // false when the change in zoom for the active tab wasn't an explicit user | 97 // false when the change in zoom for the active tab wasn't an explicit user |
| 94 // action (e.g. switching tabs, creating a new tab, creating a new browser). | 98 // action (e.g. switching tabs, creating a new tab, creating a new browser). |
| 95 // Additionally, |can_show_bubble| will only be true when the bubble wouldn't | 99 // Additionally, |can_show_bubble| will only be true when the bubble wouldn't |
| 96 // be obscured by other UI (wrench menu) or redundant (+/- from wrench). | 100 // be obscured by other UI (wrench menu) or redundant (+/- from wrench). |
| 97 void ZoomChangedForActiveTab(bool can_show_bubble); | 101 void ZoomChangedForActiveTab(bool can_show_bubble); |
| 98 | 102 |
| 99 // Checks if the bookmark star should be enabled or not. | 103 // Checks if the bookmark star should be enabled or not. |
| 100 bool IsStarEnabled() const; | 104 bool IsStarEnabled() const; |
| 101 | 105 |
| 102 // Get the point in window coordinates on the star for the bookmark bubble to | 106 // Get the point in window coordinates on the star for the bookmark bubble to |
| 103 // aim at. Only works if IsStarEnabled returns YES. | 107 // aim at. Only works if IsStarEnabled returns YES. |
| 104 NSPoint GetBookmarkBubblePoint() const; | 108 NSPoint GetBookmarkBubblePoint() const; |
| 105 | 109 |
| 110 // Get the point in window coordinates on the star for the Translate bubble to |
| 111 // aim at. |
| 112 NSPoint GetTranslateBubblePoint() const; |
| 113 |
| 106 // Get the point in window coordinates in the security icon at which the page | 114 // Get the point in window coordinates in the security icon at which the page |
| 107 // info bubble aims. | 115 // info bubble aims. |
| 108 NSPoint GetPageInfoBubblePoint() const; | 116 NSPoint GetPageInfoBubblePoint() const; |
| 109 | 117 |
| 110 // Get the point in window coordinates in the "generated cc" icon at which the | 118 // Get the point in window coordinates in the "generated cc" icon at which the |
| 111 // corresponding info bubble aims. | 119 // corresponding info bubble aims. |
| 112 NSPoint GetGeneratedCreditCardBubblePoint() const; | 120 NSPoint GetGeneratedCreditCardBubblePoint() const; |
| 113 | 121 |
| 114 // When any image decorations change, call this to ensure everything is | 122 // When any image decorations change, call this to ensure everything is |
| 115 // redrawn and laid out if necessary. | 123 // redrawn and laid out if necessary. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // Re-generate the page-action decorations from the profile's | 191 // Re-generate the page-action decorations from the profile's |
| 184 // extension service. | 192 // extension service. |
| 185 void RefreshPageActionDecorations(); | 193 void RefreshPageActionDecorations(); |
| 186 | 194 |
| 187 // Updates visibility of the content settings icons based on the current | 195 // Updates visibility of the content settings icons based on the current |
| 188 // tab contents state. | 196 // tab contents state. |
| 189 bool RefreshContentSettingsDecorations(); | 197 bool RefreshContentSettingsDecorations(); |
| 190 | 198 |
| 191 void ShowFirstRunBubbleInternal(); | 199 void ShowFirstRunBubbleInternal(); |
| 192 | 200 |
| 201 // Updates the translate decoration in the omnibox with the current translate |
| 202 // state. |
| 203 void UpdateTranslateDecoration(); |
| 204 |
| 193 // Updates the zoom decoration in the omnibox with the current zoom level. | 205 // Updates the zoom decoration in the omnibox with the current zoom level. |
| 194 void UpdateZoomDecoration(); | 206 void UpdateZoomDecoration(); |
| 195 | 207 |
| 196 // Ensures the star decoration is visible or hidden, as required. | 208 // Ensures the star decoration is visible or hidden, as required. |
| 197 void UpdateStarDecorationVisibility(); | 209 void UpdateStarDecorationVisibility(); |
| 198 | 210 |
| 199 // Updates the voice search decoration. Returns true if the visible state was | 211 // Updates the voice search decoration. Returns true if the visible state was |
| 200 // changed. | 212 // changed. |
| 201 bool UpdateMicSearchDecorationVisibility(); | 213 bool UpdateMicSearchDecorationVisibility(); |
| 202 | 214 |
| 203 scoped_ptr<OmniboxViewMac> omnibox_view_; | 215 scoped_ptr<OmniboxViewMac> omnibox_view_; |
| 204 | 216 |
| 205 AutocompleteTextField* field_; // owned by tab controller | 217 AutocompleteTextField* field_; // owned by tab controller |
| 206 | 218 |
| 207 // A decoration that shows an icon to the left of the address. | 219 // A decoration that shows an icon to the left of the address. |
| 208 scoped_ptr<LocationIconDecoration> location_icon_decoration_; | 220 scoped_ptr<LocationIconDecoration> location_icon_decoration_; |
| 209 | 221 |
| 210 // A decoration that shows the keyword-search bubble on the left. | 222 // A decoration that shows the keyword-search bubble on the left. |
| 211 scoped_ptr<SelectedKeywordDecoration> selected_keyword_decoration_; | 223 scoped_ptr<SelectedKeywordDecoration> selected_keyword_decoration_; |
| 212 | 224 |
| 213 // A decoration that shows a lock icon and ev-cert label in a bubble | 225 // A decoration that shows a lock icon and ev-cert label in a bubble |
| 214 // on the left. | 226 // on the left. |
| 215 scoped_ptr<EVBubbleDecoration> ev_bubble_decoration_; | 227 scoped_ptr<EVBubbleDecoration> ev_bubble_decoration_; |
| 216 | 228 |
| 217 // Bookmark star right of page actions. | 229 // Bookmark star right of page actions. |
| 218 scoped_ptr<StarDecoration> star_decoration_; | 230 scoped_ptr<StarDecoration> star_decoration_; |
| 219 | 231 |
| 232 // Translate icon at the end of the ominibox. |
| 233 scoped_ptr<TranslateDecoration> translate_decoration_; |
| 234 |
| 220 // A zoom icon at the end of the omnibox, which shows at non-standard zoom | 235 // A zoom icon at the end of the omnibox, which shows at non-standard zoom |
| 221 // levels. | 236 // levels. |
| 222 scoped_ptr<ZoomDecoration> zoom_decoration_; | 237 scoped_ptr<ZoomDecoration> zoom_decoration_; |
| 223 | 238 |
| 224 // The installed page actions. | 239 // The installed page actions. |
| 225 std::vector<ExtensionAction*> page_actions_; | 240 std::vector<ExtensionAction*> page_actions_; |
| 226 | 241 |
| 227 // Decorations for the installed Page Actions. | 242 // Decorations for the installed Page Actions. |
| 228 ScopedVector<PageActionDecoration> page_action_decorations_; | 243 ScopedVector<PageActionDecoration> page_action_decorations_; |
| 229 | 244 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 253 // Used to schedule a task for the first run info bubble. | 268 // Used to schedule a task for the first run info bubble. |
| 254 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; | 269 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; |
| 255 | 270 |
| 256 // Used to change the visibility of the star decoration. | 271 // Used to change the visibility of the star decoration. |
| 257 BooleanPrefMember edit_bookmarks_enabled_; | 272 BooleanPrefMember edit_bookmarks_enabled_; |
| 258 | 273 |
| 259 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 274 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
| 260 }; | 275 }; |
| 261 | 276 |
| 262 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 277 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
| OLD | NEW |