Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h

Issue 10885024: Integrate Chrome To Mobile with Action Box UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable ShowChromeToMobileBubble on GTK. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/api/prefs/pref_member.h" 16 #include "chrome/browser/api/prefs/pref_member.h"
17 #include "chrome/browser/command_observer.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;
27 class ChromeToMobileDecoration;
28 class CommandUpdater; 26 class CommandUpdater;
29 class ContentSettingDecoration; 27 class ContentSettingDecoration;
30 class EVBubbleDecoration; 28 class EVBubbleDecoration;
31 class KeywordHintDecoration; 29 class KeywordHintDecoration;
32 class LocationBarDecoration; 30 class LocationBarDecoration;
33 class LocationIconDecoration; 31 class LocationIconDecoration;
34 class PageActionDecoration; 32 class PageActionDecoration;
35 class PlusDecoration; 33 class PlusDecoration;
36 class Profile; 34 class Profile;
37 class SelectedKeywordDecoration; 35 class SelectedKeywordDecoration;
38 class StarDecoration; 36 class StarDecoration;
39 class ToolbarModel; 37 class ToolbarModel;
40 class ZoomDecoration; 38 class ZoomDecoration;
41 39
42 // A C++ bridge class that represents the location bar UI element to 40 // A C++ bridge class that represents the location bar UI element to
43 // the portable code. Wires up an OmniboxViewMac instance to 41 // the portable code. Wires up an OmniboxViewMac instance to
44 // the location bar text field, which handles most of the work. 42 // the location bar text field, which handles most of the work.
45 43
46 class LocationBarViewMac : public LocationBar, 44 class LocationBarViewMac : public LocationBar,
47 public LocationBarTesting, 45 public LocationBarTesting,
48 public OmniboxEditController, 46 public OmniboxEditController,
49 public content::NotificationObserver, 47 public content::NotificationObserver {
50 public CommandObserver {
51 public: 48 public:
52 LocationBarViewMac(AutocompleteTextField* field, 49 LocationBarViewMac(AutocompleteTextField* field,
53 CommandUpdater* command_updater, 50 CommandUpdater* command_updater,
54 ToolbarModel* toolbar_model, 51 ToolbarModel* toolbar_model,
55 Profile* profile, 52 Profile* profile,
56 Browser* browser); 53 Browser* browser);
57 virtual ~LocationBarViewMac(); 54 virtual ~LocationBarViewMac();
58 55
59 // Overridden from LocationBar: 56 // Overridden from LocationBar:
60 virtual void ShowFirstRunBubble() OVERRIDE; 57 virtual void ShowFirstRunBubble() OVERRIDE;
(...skipping 22 matching lines...) Expand all
83 virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE; 80 virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE;
84 virtual void TestPageActionPressed(size_t index) OVERRIDE; 81 virtual void TestPageActionPressed(size_t index) OVERRIDE;
85 82
86 // Set/Get the editable state of the field. 83 // Set/Get the editable state of the field.
87 void SetEditable(bool editable); 84 void SetEditable(bool editable);
88 bool IsEditable(); 85 bool IsEditable();
89 86
90 // Set the starred state of the bookmark star. 87 // Set the starred state of the bookmark star.
91 void SetStarred(bool starred); 88 void SetStarred(bool starred);
92 89
93 // Set ChromeToMobileDecoration's lit state (to update the icon). 90 // Set the icon image resource for the action box plus decoration.
94 void SetChromeToMobileDecorationLit(bool lit); 91 void SetActionBoxIcon(int image_id);
sail 2012/08/29 22:29:51 would it make sense to add this to the base Locati
msw 2012/08/29 23:11:57 LocationBar is just a pure virtual interface and V
95 92
96 // Happens when the zoom changes for the active tab. |can_show_bubble| is 93 // Happens when the zoom changes for the active tab. |can_show_bubble| is
97 // false when the change in zoom for the active tab wasn't an explicit user 94 // false when the change in zoom for the active tab wasn't an explicit user
98 // action (e.g. switching tabs, creating a new tab, creating a new browser). 95 // action (e.g. switching tabs, creating a new tab, creating a new browser).
99 // Additionally, |can_show_bubble| will only be true when the bubble wouldn't 96 // Additionally, |can_show_bubble| will only be true when the bubble wouldn't
100 // be obscured by other UI (wrench menu) or redundant (+/- from wrench). 97 // be obscured by other UI (wrench menu) or redundant (+/- from wrench).
101 void ZoomChangedForActiveTab(bool can_show_bubble); 98 void ZoomChangedForActiveTab(bool can_show_bubble);
102 99
103 // Get the point in window coordinates on the star for the bookmark bubble to 100 // Get the point in window coordinates on the star for the bookmark bubble to
104 // aim at. 101 // aim at.
105 NSPoint GetBookmarkBubblePoint() const; 102 NSPoint GetBookmarkBubblePoint() const;
106 103
107 // Get the point in window coordinates on the Action Box icon for 104 // Get the point in window coordinates on the Action Box icon for
108 // anchoring its bubbles. 105 // anchoring its bubbles.
109 NSPoint GetActionBoxAnchorPoint() const; 106 NSPoint GetActionBoxAnchorPoint() const;
110 107
111 // Get the point in window coordinates on the Chrome To Mobile icon for
112 // anchoring its bubble.
113 NSPoint GetChromeToMobileBubblePoint() const;
114
115 // Get the point in window coordinates in the security icon at which the page 108 // Get the point in window coordinates in the security icon at which the page
116 // info bubble aims. 109 // info bubble aims.
117 NSPoint GetPageInfoBubblePoint() const; 110 NSPoint GetPageInfoBubblePoint() const;
118 111
119 // When any image decorations change, call this to ensure everything is 112 // When any image decorations change, call this to ensure everything is
120 // redrawn and laid out if necessary. 113 // redrawn and laid out if necessary.
121 void OnDecorationsChanged(); 114 void OnDecorationsChanged();
122 115
123 // Updates the location bar. Resets the bar's permanent text and 116 // Updates the location bar. Resets the bar's permanent text and
124 // security style, and if |should_restore_state| is true, restores 117 // security style, and if |should_restore_state| is true, restores
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 NSImage* GetKeywordImage(const string16& keyword); 169 NSImage* GetKeywordImage(const string16& keyword);
177 170
178 AutocompleteTextField* GetAutocompleteTextField() { return field_; } 171 AutocompleteTextField* GetAutocompleteTextField() { return field_; }
179 172
180 173
181 // content::NotificationObserver: 174 // content::NotificationObserver:
182 virtual void Observe(int type, 175 virtual void Observe(int type,
183 const content::NotificationSource& source, 176 const content::NotificationSource& source,
184 const content::NotificationDetails& details) OVERRIDE; 177 const content::NotificationDetails& details) OVERRIDE;
185 178
186 // CommandObserver:
187 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE;
188
189 private: 179 private:
190 // Posts |notification| to the default notification center. 180 // Posts |notification| to the default notification center.
191 void PostNotification(NSString* notification); 181 void PostNotification(NSString* notification);
192 182
193 // Return the decoration for |page_action|. 183 // Return the decoration for |page_action|.
194 PageActionDecoration* GetPageActionDecoration(ExtensionAction* page_action); 184 PageActionDecoration* GetPageActionDecoration(ExtensionAction* page_action);
195 185
196 // Clear the page-action decorations. 186 // Clear the page-action decorations.
197 void DeletePageActionDecorations(); 187 void DeletePageActionDecorations();
198 188
199 // Re-generate the page-action decorations from the profile's 189 // Re-generate the page-action decorations from the profile's
200 // extension service. 190 // extension service.
201 void RefreshPageActionDecorations(); 191 void RefreshPageActionDecorations();
202 192
203 // Updates visibility of the content settings icons based on the current 193 // Updates visibility of the content settings icons based on the current
204 // tab contents state. 194 // tab contents state.
205 bool RefreshContentSettingsDecorations(); 195 bool RefreshContentSettingsDecorations();
206 196
207 void ShowFirstRunBubbleInternal(); 197 void ShowFirstRunBubbleInternal();
208 198
209 // Checks if the bookmark star should be enabled or not. 199 // Checks if the bookmark star should be enabled or not.
210 bool IsStarEnabled(); 200 bool IsStarEnabled();
211 201
212 // Update the Chrome To Mobile page action visibility and command state. 202 // Update the Chrome To Mobile page action command state.
213 void UpdateChromeToMobileEnabled(); 203 void UpdateChromeToMobileEnabled();
214 204
215 // Updates the zoom decoration in the omnibox with the current zoom level. 205 // Updates the zoom decoration in the omnibox with the current zoom level.
216 void UpdateZoomDecoration(); 206 void UpdateZoomDecoration();
217 207
218 // Ensures the star decoration is visible or hidden, as required. 208 // Ensures the star decoration is visible or hidden, as required.
219 void UpdateStarDecorationVisibility(); 209 void UpdateStarDecorationVisibility();
220 210
221 scoped_ptr<OmniboxViewMac> omnibox_view_; 211 scoped_ptr<OmniboxViewMac> omnibox_view_;
222 212
(...skipping 18 matching lines...) Expand all
241 // A decoration that shows a lock icon and ev-cert label in a bubble 231 // A decoration that shows a lock icon and ev-cert label in a bubble
242 // on the left. 232 // on the left.
243 scoped_ptr<EVBubbleDecoration> ev_bubble_decoration_; 233 scoped_ptr<EVBubbleDecoration> ev_bubble_decoration_;
244 234
245 // Action "plus" button right of bookmark star. 235 // Action "plus" button right of bookmark star.
246 scoped_ptr<PlusDecoration> plus_decoration_; 236 scoped_ptr<PlusDecoration> plus_decoration_;
247 237
248 // Bookmark star right of page actions. 238 // Bookmark star right of page actions.
249 scoped_ptr<StarDecoration> star_decoration_; 239 scoped_ptr<StarDecoration> star_decoration_;
250 240
251 // Chrome To Mobile page action icon.
252 scoped_ptr<ChromeToMobileDecoration> chrome_to_mobile_decoration_;
253
254 // A zoom icon at the end of the omnibox, which shows at non-standard zoom 241 // A zoom icon at the end of the omnibox, which shows at non-standard zoom
255 // levels. 242 // levels.
256 scoped_ptr<ZoomDecoration> zoom_decoration_; 243 scoped_ptr<ZoomDecoration> zoom_decoration_;
257 244
258 // The installed page actions. 245 // The installed page actions.
259 std::vector<ExtensionAction*> page_actions_; 246 std::vector<ExtensionAction*> page_actions_;
260 247
261 // Decorations for the installed Page Actions. 248 // Decorations for the installed Page Actions.
262 ScopedVector<PageActionDecoration> page_action_decorations_; 249 ScopedVector<PageActionDecoration> page_action_decorations_;
263 250
(...skipping 18 matching lines...) Expand all
282 // Used to schedule a task for the first run info bubble. 269 // Used to schedule a task for the first run info bubble.
283 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; 270 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_;
284 271
285 // Used to change the visibility of the star decoration. 272 // Used to change the visibility of the star decoration.
286 BooleanPrefMember edit_bookmarks_enabled_; 273 BooleanPrefMember edit_bookmarks_enabled_;
287 274
288 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); 275 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac);
289 }; 276 };
290 277
291 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ 278 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698