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