| 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> |
| 11 | 11 |
| 12 #include "base/memory/scoped_nsobject.h" | 12 #include "base/memory/scoped_nsobject.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/prefs/public/pref_observer.h" | |
| 17 #include "chrome/browser/api/prefs/pref_member.h" | 16 #include "chrome/browser/api/prefs/pref_member.h" |
| 18 #include "chrome/browser/extensions/image_loading_tracker.h" | 17 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 19 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 19 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
| 21 #include "chrome/browser/ui/omnibox/location_bar.h" | 20 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 22 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 21 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
| 23 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 22 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 24 #include "chrome/common/content_settings_types.h" | 23 #include "chrome/common/content_settings_types.h" |
| 25 | 24 |
| 26 @class AutocompleteTextField; | 25 @class AutocompleteTextField; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 39 class WebIntentsButtonDecoration; | 38 class WebIntentsButtonDecoration; |
| 40 class ZoomDecoration; | 39 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 PrefObserver { | |
| 51 public: | 49 public: |
| 52 LocationBarViewMac(AutocompleteTextField* field, | 50 LocationBarViewMac(AutocompleteTextField* field, |
| 53 CommandUpdater* command_updater, | 51 CommandUpdater* command_updater, |
| 54 ToolbarModel* toolbar_model, | 52 ToolbarModel* toolbar_model, |
| 55 Profile* profile, | 53 Profile* profile, |
| 56 Browser* browser); | 54 Browser* browser); |
| 57 virtual ~LocationBarViewMac(); | 55 virtual ~LocationBarViewMac(); |
| 58 | 56 |
| 59 // Overridden from LocationBar: | 57 // Overridden from LocationBar: |
| 60 virtual void ShowFirstRunBubble() OVERRIDE; | 58 virtual void ShowFirstRunBubble() OVERRIDE; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 NSImage* GetKeywordImage(const string16& keyword); | 171 NSImage* GetKeywordImage(const string16& keyword); |
| 174 | 172 |
| 175 AutocompleteTextField* GetAutocompleteTextField() { return field_; } | 173 AutocompleteTextField* GetAutocompleteTextField() { return field_; } |
| 176 | 174 |
| 177 | 175 |
| 178 // content::NotificationObserver: | 176 // content::NotificationObserver: |
| 179 virtual void Observe(int type, | 177 virtual void Observe(int type, |
| 180 const content::NotificationSource& source, | 178 const content::NotificationSource& source, |
| 181 const content::NotificationDetails& details) OVERRIDE; | 179 const content::NotificationDetails& details) OVERRIDE; |
| 182 | 180 |
| 183 // PrefObserver: | |
| 184 virtual void OnPreferenceChanged(PrefServiceBase* service, | |
| 185 const std::string& pref_name) OVERRIDE; | |
| 186 | |
| 187 Browser* browser() const { return browser_; } | 181 Browser* browser() const { return browser_; } |
| 188 | 182 |
| 189 private: | 183 private: |
| 190 // Posts |notification| to the default notification center. | 184 // Posts |notification| to the default notification center. |
| 191 void PostNotification(NSString* notification); | 185 void PostNotification(NSString* notification); |
| 192 | 186 |
| 193 // Return the decoration for |page_action|. | 187 // Return the decoration for |page_action|. |
| 194 PageActionDecoration* GetPageActionDecoration(ExtensionAction* page_action); | 188 PageActionDecoration* GetPageActionDecoration(ExtensionAction* page_action); |
| 195 | 189 |
| 196 // Clear the page-action decorations. | 190 // Clear the page-action decorations. |
| 197 void DeletePageActionDecorations(); | 191 void DeletePageActionDecorations(); |
| 198 | 192 |
| 193 void OnEditBookmarksEnabledChanged(); |
| 194 |
| 199 // Re-generate the page-action decorations from the profile's | 195 // Re-generate the page-action decorations from the profile's |
| 200 // extension service. | 196 // extension service. |
| 201 void RefreshPageActionDecorations(); | 197 void RefreshPageActionDecorations(); |
| 202 | 198 |
| 203 // Updates visibility of the content settings icons based on the current | 199 // Updates visibility of the content settings icons based on the current |
| 204 // tab contents state. | 200 // tab contents state. |
| 205 bool RefreshContentSettingsDecorations(); | 201 bool RefreshContentSettingsDecorations(); |
| 206 | 202 |
| 207 // Updates visibility of the web intents button decoration based on the | 203 // Updates visibility of the web intents button decoration based on the |
| 208 // current tab contents state. | 204 // current tab contents state. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 // Used to schedule a task for the first run info bubble. | 283 // Used to schedule a task for the first run info bubble. |
| 288 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; | 284 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; |
| 289 | 285 |
| 290 // Used to change the visibility of the star decoration. | 286 // Used to change the visibility of the star decoration. |
| 291 BooleanPrefMember edit_bookmarks_enabled_; | 287 BooleanPrefMember edit_bookmarks_enabled_; |
| 292 | 288 |
| 293 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 289 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
| 294 }; | 290 }; |
| 295 | 291 |
| 296 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 292 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
| OLD | NEW |