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