| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 376 |
| 377 // Both Layout and OnChanged call into this. This updates the contents | 377 // Both Layout and OnChanged call into this. This updates the contents |
| 378 // of the 3 views: selected_keyword, keyword_hint and type_search_view. If | 378 // of the 3 views: selected_keyword, keyword_hint and type_search_view. If |
| 379 // force_layout is true, or one of these views has changed in such a way as | 379 // force_layout is true, or one of these views has changed in such a way as |
| 380 // to necessitate a layout, layout occurs as well. | 380 // to necessitate a layout, layout occurs as well. |
| 381 void DoLayout(bool force_layout); | 381 void DoLayout(bool force_layout); |
| 382 | 382 |
| 383 // Returns the height in pixels of the margin at the top of the bar. | 383 // Returns the height in pixels of the margin at the top of the bar. |
| 384 int TopMargin() const; | 384 int TopMargin() const; |
| 385 | 385 |
| 386 // Returns the width in pixels of the contents of the edit. | 386 // Returns the amount of horizontal space (in pixels) out of |
| 387 int TextDisplayWidth(); | 387 // |location_bar_width| that is not taken up by the actual text in |
| 388 // location_entry_. |
| 389 int AvailableWidth(int location_bar_width); |
| 388 | 390 |
| 389 // Returns true if the preferred size should be used for a view whose width | 391 // Returns whether the |available_width| is large enough to contain a view |
| 390 // is pref_width, the width of the text in the edit is text_width, and | 392 // with preferred width |pref_width| at its preferred size. If this returns |
| 391 // max_width is the maximum width of the edit. If this returns false, the | 393 // true, the preferred size should be used. If this returns false, the |
| 392 // minimum size of the view should be used. | 394 // minimum size of the view should be used. |
| 393 bool UsePref(int pref_width, int text_width, int max_width); | 395 bool UsePref(int pref_width, int available_width); |
| 394 | 396 |
| 395 // Returns true if the view needs to be resized. This determines whether the | 397 // Returns true if the view needs to be resized. This determines whether the |
| 396 // min or pref should be used, and returns true if the view is not at that | 398 // min or pref should be used, and returns true if the view is not at that |
| 397 // size. | 399 // size. |
| 398 bool NeedsResize(View* view, int text_width, int max_width); | 400 bool NeedsResize(View* view, int available_width); |
| 399 | 401 |
| 400 // Adjusts the keyword hint, selected keyword and type to search views | 402 // Adjusts the keyword hint, selected keyword and type to search views |
| 401 // based on the contents of the edit. Returns true if something changed that | 403 // based on the contents of the edit. Returns true if something changed that |
| 402 // necessitates a layout. | 404 // necessitates a layout. |
| 403 bool AdjustHints(int text_width, int max_width); | 405 bool AdjustHints(int available_width); |
| 404 | 406 |
| 405 // If View fits in the specified region, it is made visible and the | 407 // If View fits in the specified region, it is made visible and the |
| 406 // bounds are adjusted appropriately. If the View does not fit, it is | 408 // bounds are adjusted appropriately. If the View does not fit, it is |
| 407 // made invisible. | 409 // made invisible. |
| 408 void LayoutView(bool leading, views::View* view, int text_width, | 410 void LayoutView(bool leading, views::View* view, int available_width, |
| 409 int max_width, gfx::Rect* bounds); | 411 gfx::Rect* bounds); |
| 410 | 412 |
| 411 // Sets the security icon to display. Note that no repaint is done. | 413 // Sets the security icon to display. Note that no repaint is done. |
| 412 void SetSecurityIcon(ToolbarModel::Icon icon); | 414 void SetSecurityIcon(ToolbarModel::Icon icon); |
| 413 | 415 |
| 414 // Delete all page action views that we have created. | 416 // Delete all page action views that we have created. |
| 415 void DeletePageActionViews(); | 417 void DeletePageActionViews(); |
| 416 | 418 |
| 417 // Retrieves a vector of all page actions, irrespective of which | 419 // Retrieves a vector of all page actions, irrespective of which |
| 418 // extension they belong to. | 420 // extension they belong to. |
| 419 std::vector<PageAction*> GetPageActions(); | 421 std::vector<PageAction*> GetPageActions(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 bool popup_window_mode_; | 506 bool popup_window_mode_; |
| 505 | 507 |
| 506 // Used schedule a task for the first run info bubble. | 508 // Used schedule a task for the first run info bubble. |
| 507 ScopedRunnableMethodFactory<LocationBarView> first_run_bubble_; | 509 ScopedRunnableMethodFactory<LocationBarView> first_run_bubble_; |
| 508 | 510 |
| 509 // The positioner that places the autocomplete popup. | 511 // The positioner that places the autocomplete popup. |
| 510 AutocompletePopupPositioner* popup_positioner_; | 512 AutocompletePopupPositioner* popup_positioner_; |
| 511 }; | 513 }; |
| 512 | 514 |
| 513 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ | 515 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ |
| OLD | NEW |