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_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 }; | 138 }; |
139 | 139 |
140 LocationBarView(Browser* browser, | 140 LocationBarView(Browser* browser, |
141 Profile* profile, | 141 Profile* profile, |
142 CommandUpdater* command_updater, | 142 CommandUpdater* command_updater, |
143 Delegate* delegate, | 143 Delegate* delegate, |
144 bool is_popup_mode); | 144 bool is_popup_mode); |
145 | 145 |
146 virtual ~LocationBarView(); | 146 virtual ~LocationBarView(); |
147 | 147 |
148 // Uses GetBuiltInHorizontalPaddingForChildViews() to optionally add | |
149 // additional padding (via an empty border) to |view|. This should be called | |
150 // during creation on all child views which are potentially touchable so that | |
151 // when touch is enabled they will have sufficient padding. | |
152 static void InitTouchableLocationBarChildView(views::View* view); | |
153 | |
154 // Initializes the LocationBarView. | 148 // Initializes the LocationBarView. |
155 void Init(); | 149 void Init(); |
156 | 150 |
157 // True if this instance has been initialized by calling Init, which can only | 151 // True if this instance has been initialized by calling Init, which can only |
158 // be called when the receiving instance is attached to a view container. | 152 // be called when the receiving instance is attached to a view container. |
159 bool IsInitialized() const; | 153 bool IsInitialized() const; |
160 | 154 |
161 // Returns the appropriate color for the desired kind, based on the user's | 155 // Returns the appropriate color for the desired kind, based on the user's |
162 // system theme. | 156 // system theme. |
163 SkColor GetColor(ToolbarModel::SecurityLevel security_level, | 157 SkColor GetColor(ToolbarModel::SecurityLevel security_level, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 int GetInternalHeight(bool use_preferred_size); | 246 int GetInternalHeight(bool use_preferred_size); |
253 | 247 |
254 // Returns the position and width that the popup should be, and also the left | 248 // Returns the position and width that the popup should be, and also the left |
255 // edge that the results should align themselves to (which will leave some | 249 // edge that the results should align themselves to (which will leave some |
256 // border on the left of the popup). | 250 // border on the left of the popup). |
257 void GetOmniboxPopupPositioningInfo(gfx::Point* top_left_screen_coord, | 251 void GetOmniboxPopupPositioningInfo(gfx::Point* top_left_screen_coord, |
258 int* popup_width, | 252 int* popup_width, |
259 int* left_margin, | 253 int* left_margin, |
260 int* right_margin); | 254 int* right_margin); |
261 | 255 |
262 // Space between items in the location bar, as well as between items and the | |
263 // edges. | |
264 static int GetItemPadding(); | |
265 | |
266 // LocationBar: | 256 // LocationBar: |
267 virtual void FocusLocation(bool select_all) OVERRIDE; | 257 virtual void FocusLocation(bool select_all) OVERRIDE; |
268 virtual void Revert() OVERRIDE; | 258 virtual void Revert() OVERRIDE; |
269 virtual OmniboxView* GetOmniboxView() OVERRIDE; | 259 virtual OmniboxView* GetOmniboxView() OVERRIDE; |
270 | 260 |
271 // views::View: | 261 // views::View: |
272 virtual bool HasFocus() const OVERRIDE; | 262 virtual bool HasFocus() const OVERRIDE; |
273 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 263 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
274 virtual gfx::Size GetPreferredSize() OVERRIDE; | 264 virtual gfx::Size GetPreferredSize() OVERRIDE; |
275 virtual void Layout() OVERRIDE; | 265 virtual void Layout() OVERRIDE; |
276 | 266 |
277 // OmniboxEditController: | 267 // OmniboxEditController: |
278 virtual void Update(const content::WebContents* contents) OVERRIDE; | 268 virtual void Update(const content::WebContents* contents) OVERRIDE; |
279 virtual void ShowURL() OVERRIDE; | 269 virtual void ShowURL() OVERRIDE; |
280 virtual ToolbarModel* GetToolbarModel() OVERRIDE; | 270 virtual ToolbarModel* GetToolbarModel() OVERRIDE; |
281 virtual content::WebContents* GetWebContents() OVERRIDE; | 271 virtual content::WebContents* GetWebContents() OVERRIDE; |
282 | 272 |
283 // Thickness of the edges of the omnibox background images, in normal mode. | 273 // Thickness of the edges of the omnibox background images, in normal mode. |
284 static const int kNormalEdgeThickness; | 274 static const int kNormalEdgeThickness; |
285 // The same, but for popup mode. | 275 // The same, but for popup mode. |
286 static const int kPopupEdgeThickness; | 276 static const int kPopupEdgeThickness; |
| 277 // Space between items in the location bar, as well as between items and the |
| 278 // edges. |
| 279 static const int kItemPadding; |
287 // Amount of padding built into the standard omnibox icons. | 280 // Amount of padding built into the standard omnibox icons. |
288 static const int kIconInternalPadding; | 281 static const int kIconInternalPadding; |
289 // Amount of padding to place between the origin chip and the leading edge of | 282 // Amount of padding to place between the origin chip and the leading edge of |
290 // the location bar. | 283 // the location bar. |
291 static const int kOriginChipEdgeItemPadding; | 284 static const int kOriginChipEdgeItemPadding; |
292 // Amount of padding built into the origin chip. | 285 // Amount of padding built into the origin chip. |
293 static const int kOriginChipBuiltinPadding; | 286 static const int kOriginChipBuiltinPadding; |
294 // Space between the edge and a bubble. | 287 // Space between the edge and a bubble. |
295 static const int kBubblePadding; | 288 static const int kBubblePadding; |
296 | 289 |
297 private: | 290 private: |
298 typedef std::vector<ContentSettingImageView*> ContentSettingViews; | 291 typedef std::vector<ContentSettingImageView*> ContentSettingViews; |
299 | 292 |
300 friend class PageActionImageView; | 293 friend class PageActionImageView; |
301 friend class PageActionWithBadgeView; | 294 friend class PageActionWithBadgeView; |
302 typedef std::vector<ExtensionAction*> PageActions; | 295 typedef std::vector<ExtensionAction*> PageActions; |
303 typedef std::vector<PageActionWithBadgeView*> PageActionViews; | 296 typedef std::vector<PageActionWithBadgeView*> PageActionViews; |
304 | 297 |
305 // Returns the number of pixels of built-in padding to the left and right for | |
306 // child views. This is nonzero when touch UI is enabled so as to space out | |
307 // child views for easier targeting. See InitTouchableLocationBarChildView(). | |
308 static int GetBuiltInHorizontalPaddingForChildViews(); | |
309 | |
310 // Returns the thickness of any visible left and right edge, in pixels. | 298 // Returns the thickness of any visible left and right edge, in pixels. |
311 int GetHorizontalEdgeThickness() const; | 299 int GetHorizontalEdgeThickness() const; |
312 | 300 |
313 // The same, but for the top and bottom edges. | 301 // The same, but for the top and bottom edges. |
314 int vertical_edge_thickness() const { | 302 int vertical_edge_thickness() const { |
315 return is_popup_mode_ ? kPopupEdgeThickness : kNormalEdgeThickness; | 303 return is_popup_mode_ ? kPopupEdgeThickness : kNormalEdgeThickness; |
316 } | 304 } |
317 | 305 |
318 // Updates the visibility state of the Content Blocked icons to reflect what | 306 // Updates the visibility state of the Content Blocked icons to reflect what |
319 // is actually blocked on the current page. Returns true if the visibility | 307 // is actually blocked on the current page. Returns true if the visibility |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 // Used to register for notifications received by NotificationObserver. | 528 // Used to register for notifications received by NotificationObserver. |
541 content::NotificationRegistrar registrar_; | 529 content::NotificationRegistrar registrar_; |
542 | 530 |
543 // Used to bind callback functions to this object. | 531 // Used to bind callback functions to this object. |
544 base::WeakPtrFactory<LocationBarView> weak_ptr_factory_; | 532 base::WeakPtrFactory<LocationBarView> weak_ptr_factory_; |
545 | 533 |
546 DISALLOW_COPY_AND_ASSIGN(LocationBarView); | 534 DISALLOW_COPY_AND_ASSIGN(LocationBarView); |
547 }; | 535 }; |
548 | 536 |
549 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 537 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
OLD | NEW |