| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // Overridden from LocationBarTesting: | 220 // Overridden from LocationBarTesting: |
| 221 virtual int PageActionCount() { return page_action_views_.size(); } | 221 virtual int PageActionCount() { return page_action_views_.size(); } |
| 222 virtual int PageActionVisibleCount(); | 222 virtual int PageActionVisibleCount(); |
| 223 virtual ExtensionAction* GetPageAction(size_t index); | 223 virtual ExtensionAction* GetPageAction(size_t index); |
| 224 virtual ExtensionAction* GetVisiblePageAction(size_t index); | 224 virtual ExtensionAction* GetVisiblePageAction(size_t index); |
| 225 virtual void TestPageActionPressed(size_t index); | 225 virtual void TestPageActionPressed(size_t index); |
| 226 | 226 |
| 227 // Overridden from TemplateURLModelObserver | 227 // Overridden from TemplateURLModelObserver |
| 228 virtual void OnTemplateURLModelChanged(); | 228 virtual void OnTemplateURLModelChanged(); |
| 229 | 229 |
| 230 static const int kVertMargin; // Space above and below the edit. | 230 // Thickness of the left and right edges of the omnibox, in normal mode. |
| 231 static const int kEdgeThickness; // Unavailable space at horizontal edges. | 231 static const int kNormalHorizontalEdgeThickness; |
| 232 static const int kItemPadding; // Space between items within the bar. | 232 // Thickness of the top and bottom edges of the omnibox. |
| 233 static const int kVerticalEdgeThickness; |
| 234 // Space between items in the location bar. |
| 235 static const int kItemPadding; |
| 236 // Space between the edges and the items next to them. |
| 237 static const int kEdgeItemPadding; |
| 238 // Space between the edge and a bubble. |
| 239 static const int kBubblePadding; |
| 233 | 240 |
| 234 protected: | 241 protected: |
| 235 void Focus(); | 242 void Focus(); |
| 236 | 243 |
| 237 private: | 244 private: |
| 238 typedef std::vector<ContentSettingImageView*> ContentSettingViews; | 245 typedef std::vector<ContentSettingImageView*> ContentSettingViews; |
| 239 | 246 |
| 240 friend class PageActionImageView; | 247 friend class PageActionImageView; |
| 241 friend class PageActionWithBadgeView; | 248 friend class PageActionWithBadgeView; |
| 242 typedef std::vector<PageActionWithBadgeView*> PageActionViews; | 249 typedef std::vector<PageActionWithBadgeView*> PageActionViews; |
| 243 | 250 |
| 244 // Returns the height in pixels of the margin at the top of the bar. | |
| 245 int TopMargin() const; | |
| 246 | |
| 247 // Returns the amount of horizontal space (in pixels) out of | 251 // Returns the amount of horizontal space (in pixels) out of |
| 248 // |location_bar_width| that is not taken up by the actual text in | 252 // |location_bar_width| that is not taken up by the actual text in |
| 249 // location_entry_. | 253 // location_entry_. |
| 250 int AvailableWidth(int location_bar_width); | 254 int AvailableWidth(int location_bar_width); |
| 251 | 255 |
| 252 // Returns whether the |available_width| is large enough to contain a view | 256 // If |view| fits in |available_width|, it is made visible and positioned at |
| 253 // with preferred width |pref_width| at its preferred size. If this returns | 257 // the leading or trailing end of |bounds|, which are then shrunk |
| 254 // true, the preferred size should be used. If this returns false, the | 258 // appropriately. Otherwise |view| is made invisible. |
| 255 // minimum size of the view should be used. | 259 // Note: |view| is expected to have already been positioned and sized |
| 256 bool UsePref(int pref_width, int available_width); | 260 // vertically. |
| 257 | 261 void LayoutView(views::View* view, |
| 258 // If View fits in the specified region, it is made visible and the | 262 int padding, |
| 259 // bounds are adjusted appropriately. If the View does not fit, it is | 263 int available_width, |
| 260 // made invisible. | 264 bool leading, |
| 261 void LayoutView(bool leading, views::View* view, int available_width, | |
| 262 gfx::Rect* bounds); | 265 gfx::Rect* bounds); |
| 263 | 266 |
| 264 // Update the visibility state of the Content Blocked icons to reflect what is | 267 // Update the visibility state of the Content Blocked icons to reflect what is |
| 265 // actually blocked on the current page. | 268 // actually blocked on the current page. |
| 266 void RefreshContentSettingViews(); | 269 void RefreshContentSettingViews(); |
| 267 | 270 |
| 268 // Delete all page action views that we have created. | 271 // Delete all page action views that we have created. |
| 269 void DeletePageActionViews(); | 272 void DeletePageActionViews(); |
| 270 | 273 |
| 271 // Update the views for the Page Actions, to reflect state changes for | 274 // Update the views for the Page Actions, to reflect state changes for |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 TemplateURLModel* template_url_model_; | 374 TemplateURLModel* template_url_model_; |
| 372 | 375 |
| 373 #if defined(OS_LINUX) | 376 #if defined(OS_LINUX) |
| 374 scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_; | 377 scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_; |
| 375 #endif | 378 #endif |
| 376 | 379 |
| 377 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); | 380 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); |
| 378 }; | 381 }; |
| 379 | 382 |
| 380 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 383 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
| OLD | NEW |