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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 NSImage* GetKeywordImage(const string16& keyword); | 176 NSImage* GetKeywordImage(const string16& keyword); |
175 | 177 |
176 AutocompleteTextField* GetAutocompleteTextField() { return field_; } | 178 AutocompleteTextField* GetAutocompleteTextField() { return field_; } |
177 | 179 |
178 | 180 |
179 // content::NotificationObserver: | 181 // content::NotificationObserver: |
180 virtual void Observe(int type, | 182 virtual void Observe(int type, |
181 const content::NotificationSource& source, | 183 const content::NotificationSource& source, |
182 const content::NotificationDetails& details) OVERRIDE; | 184 const content::NotificationDetails& details) OVERRIDE; |
183 | 185 |
| 186 // PrefObserver: |
| 187 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 188 const std::string& pref_name) OVERRIDE; |
| 189 |
184 Browser* browser() const { return browser_; } | 190 Browser* browser() const { return browser_; } |
185 | 191 |
186 private: | 192 private: |
187 // Posts |notification| to the default notification center. | 193 // Posts |notification| to the default notification center. |
188 void PostNotification(NSString* notification); | 194 void PostNotification(NSString* notification); |
189 | 195 |
190 // Return the decoration for |page_action|. | 196 // Return the decoration for |page_action|. |
191 PageActionDecoration* GetPageActionDecoration(ExtensionAction* page_action); | 197 PageActionDecoration* GetPageActionDecoration(ExtensionAction* page_action); |
192 | 198 |
193 // Clear the page-action decorations. | 199 // Clear the page-action decorations. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // Used to schedule a task for the first run info bubble. | 290 // Used to schedule a task for the first run info bubble. |
285 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; | 291 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; |
286 | 292 |
287 // Used to change the visibility of the star decoration. | 293 // Used to change the visibility of the star decoration. |
288 BooleanPrefMember edit_bookmarks_enabled_; | 294 BooleanPrefMember edit_bookmarks_enabled_; |
289 | 295 |
290 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 296 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
291 }; | 297 }; |
292 | 298 |
293 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 299 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
OLD | NEW |