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_updater.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 11 matching lines...) Expand all Loading... |
38 class ToolbarModel; | 39 class ToolbarModel; |
39 | 40 |
40 // 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 |
41 // the portable code. Wires up an OmniboxViewMac instance to | 42 // the portable code. Wires up an OmniboxViewMac instance to |
42 // the location bar text field, which handles most of the work. | 43 // the location bar text field, which handles most of the work. |
43 | 44 |
44 class LocationBarViewMac : public LocationBar, | 45 class LocationBarViewMac : public LocationBar, |
45 public LocationBarTesting, | 46 public LocationBarTesting, |
46 public OmniboxEditController, | 47 public OmniboxEditController, |
47 public content::NotificationObserver, | 48 public content::NotificationObserver, |
48 public CommandUpdater::CommandObserver { | 49 public CommandObserver { |
49 public: | 50 public: |
50 LocationBarViewMac(AutocompleteTextField* field, | 51 LocationBarViewMac(AutocompleteTextField* field, |
51 CommandUpdater* command_updater, | 52 CommandUpdater* command_updater, |
52 ToolbarModel* toolbar_model, | 53 ToolbarModel* toolbar_model, |
53 Profile* profile, | 54 Profile* profile, |
54 Browser* browser); | 55 Browser* browser); |
55 virtual ~LocationBarViewMac(); | 56 virtual ~LocationBarViewMac(); |
56 | 57 |
57 // Overridden from LocationBar: | 58 // Overridden from LocationBar: |
58 virtual void ShowFirstRunBubble() OVERRIDE; | 59 virtual void ShowFirstRunBubble() OVERRIDE; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 NSImage* GetKeywordImage(const string16& keyword); | 153 NSImage* GetKeywordImage(const string16& keyword); |
153 | 154 |
154 AutocompleteTextField* GetAutocompleteTextField() { return field_; } | 155 AutocompleteTextField* GetAutocompleteTextField() { return field_; } |
155 | 156 |
156 | 157 |
157 // content::NotificationObserver: | 158 // content::NotificationObserver: |
158 virtual void Observe(int type, | 159 virtual void Observe(int type, |
159 const content::NotificationSource& source, | 160 const content::NotificationSource& source, |
160 const content::NotificationDetails& details) OVERRIDE; | 161 const content::NotificationDetails& details) OVERRIDE; |
161 | 162 |
162 // CommandUpdater::CommandObserver: | 163 // CommandObserver: |
163 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; | 164 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; |
164 | 165 |
165 private: | 166 private: |
166 // Posts |notification| to the default notification center. | 167 // Posts |notification| to the default notification center. |
167 void PostNotification(NSString* notification); | 168 void PostNotification(NSString* notification); |
168 | 169 |
169 // Return the decoration for |page_action|. | 170 // Return the decoration for |page_action|. |
170 PageActionDecoration* GetPageActionDecoration(ExtensionAction* page_action); | 171 PageActionDecoration* GetPageActionDecoration(ExtensionAction* page_action); |
171 | 172 |
172 // Clear the page-action decorations. | 173 // Clear the page-action decorations. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // Used to schedule a task for the first run info bubble. | 246 // Used to schedule a task for the first run info bubble. |
246 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; | 247 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; |
247 | 248 |
248 // Used to change the visibility of the star decoration. | 249 // Used to change the visibility of the star decoration. |
249 BooleanPrefMember edit_bookmarks_enabled_; | 250 BooleanPrefMember edit_bookmarks_enabled_; |
250 | 251 |
251 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 252 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
252 }; | 253 }; |
253 | 254 |
254 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 255 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
OLD | NEW |