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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #import <Cocoa/Cocoa.h> | 11 #import <Cocoa/Cocoa.h> |
12 | 12 |
13 #include "base/memory/scoped_nsobject.h" | 13 #include "base/memory/scoped_nsobject.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "chrome/browser/command_observer.h" |
17 #include "chrome/browser/extensions/image_loading_tracker.h" | 18 #include "chrome/browser/extensions/image_loading_tracker.h" |
18 #include "chrome/browser/prefs/pref_member.h" | 19 #include "chrome/browser/prefs/pref_member.h" |
19 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 21 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
21 #include "chrome/browser/ui/omnibox/location_bar.h" | 22 #include "chrome/browser/ui/omnibox/location_bar.h" |
22 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 23 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
23 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 24 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
24 #include "chrome/common/content_settings_types.h" | 25 #include "chrome/common/content_settings_types.h" |
25 | 26 |
26 @class AutocompleteTextField; | 27 @class AutocompleteTextField; |
(...skipping 12 matching lines...) Expand all Loading... |
39 class ToolbarModel; | 40 class ToolbarModel; |
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, |
49 public CommandUpdater::CommandObserver { | 50 public CommandObserver { |
50 public: | 51 public: |
51 LocationBarViewMac(AutocompleteTextField* field, | 52 LocationBarViewMac(AutocompleteTextField* field, |
52 CommandUpdater* command_updater, | 53 CommandUpdater* command_updater, |
53 ToolbarModel* toolbar_model, | 54 ToolbarModel* toolbar_model, |
54 Profile* profile, | 55 Profile* profile, |
55 Browser* browser); | 56 Browser* browser); |
56 virtual ~LocationBarViewMac(); | 57 virtual ~LocationBarViewMac(); |
57 | 58 |
58 // Overridden from LocationBar: | 59 // Overridden from LocationBar: |
59 virtual void ShowFirstRunBubble() OVERRIDE; | 60 virtual void ShowFirstRunBubble() OVERRIDE; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 NSImage* GetKeywordImage(const string16& keyword); | 157 NSImage* GetKeywordImage(const string16& keyword); |
157 | 158 |
158 AutocompleteTextField* GetAutocompleteTextField() { return field_; } | 159 AutocompleteTextField* GetAutocompleteTextField() { return field_; } |
159 | 160 |
160 | 161 |
161 // content::NotificationObserver: | 162 // content::NotificationObserver: |
162 virtual void Observe(int type, | 163 virtual void Observe(int type, |
163 const content::NotificationSource& source, | 164 const content::NotificationSource& source, |
164 const content::NotificationDetails& details) OVERRIDE; | 165 const content::NotificationDetails& details) OVERRIDE; |
165 | 166 |
166 // CommandUpdater::CommandObserver: | 167 // CommandObserver: |
167 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; | 168 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; |
168 | 169 |
169 private: | 170 private: |
170 // Posts |notification| to the default notification center. | 171 // Posts |notification| to the default notification center. |
171 void PostNotification(NSString* notification); | 172 void PostNotification(NSString* notification); |
172 | 173 |
173 // Return the decoration for |page_action|. | 174 // Return the decoration for |page_action|. |
174 PageActionDecoration* GetPageActionDecoration(ExtensionAction* page_action); | 175 PageActionDecoration* GetPageActionDecoration(ExtensionAction* page_action); |
175 | 176 |
176 // Clear the page-action decorations. | 177 // Clear the page-action decorations. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 // Used to schedule a task for the first run info bubble. | 250 // Used to schedule a task for the first run info bubble. |
250 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; | 251 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; |
251 | 252 |
252 // Used to change the visibility of the star decoration. | 253 // Used to change the visibility of the star decoration. |
253 BooleanPrefMember edit_bookmarks_enabled_; | 254 BooleanPrefMember edit_bookmarks_enabled_; |
254 | 255 |
255 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 256 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
256 }; | 257 }; |
257 | 258 |
258 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 259 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
OLD | NEW |