Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_LAYOUT_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 | 9 |
| 10 namespace gfx { | 10 namespace gfx { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 bool auto_collapse, | 48 bool auto_collapse, |
| 49 double max_fraction, | 49 double max_fraction, |
| 50 int edge_item_padding, | 50 int edge_item_padding, |
| 51 int item_padding, | 51 int item_padding, |
| 52 int builtin_padding, | 52 int builtin_padding, |
| 53 views::View* view); | 53 views::View* view); |
| 54 | 54 |
| 55 // Add a non-resizable decoration with standard padding. | 55 // Add a non-resizable decoration with standard padding. |
| 56 void AddDecoration(int height, int builtin_padding, views::View* view); | 56 void AddDecoration(int height, int builtin_padding, views::View* view); |
| 57 | 57 |
| 58 // Add a separator, specifying: | |
| 59 // - The |y| position inside its parent; | |
| 60 // - The |height| in pixel; | |
|
Peter Kasting
2013/01/17 04:14:22
Nit: pixels. Though, it's weird to note that only
kuan
2013/01/17 17:57:43
Done.
| |
| 61 // - |padding|, the padding between the previous item and this separator; | |
| 62 // - The |view| corresponding to this separator, a weak pointer. | |
| 63 void AddSeparator(int y, int height, int padding, views::View* view); | |
| 64 | |
| 58 // First pass of decoration layout process. Pass the full width of the | 65 // First pass of decoration layout process. Pass the full width of the |
| 59 // location bar in |entry_width|. This pass will adjust it to account for | 66 // location bar in |entry_width|. This pass will adjust it to account for |
| 60 // non-collapsible and non-resizable decorations. | 67 // non-collapsible and non-resizable decorations. |
| 61 void LayoutPass1(int* entry_width); | 68 void LayoutPass1(int* entry_width); |
| 62 | 69 |
| 63 // Second pass of decoration layout process. Pass the |entry_width| computed | 70 // Second pass of decoration layout process. Pass the |entry_width| computed |
| 64 // by the first pass. This pass will adjust it to account for resizable | 71 // by the first pass. This pass will adjust it to account for resizable |
| 65 // decorations. | 72 // decorations. |
| 66 void LayoutPass2(int* entry_width); | 73 void LayoutPass2(int* entry_width); |
| 67 | 74 |
| 68 // Third and final pass of decoration layout process. Pass the |bounds| | 75 // Third and final pass of decoration layout process. Pass the |bounds| |
| 69 // corresponding to the entire space available in the location bar. This pass | 76 // corresponding to the entire space available in the location bar. This pass |
| 70 // will update it as decorations are laid out. |available_width| measures the | 77 // will update it as decorations are laid out. |available_width| measures the |
| 71 // empty space within the location bar, taking the decorations and text into | 78 // empty space within the location bar, taking the decorations and text into |
| 72 // account. |decorations| must always be ordered from the edge of the location | 79 // account. |decorations| must always be ordered from the edge of the location |
| 73 // bar towards the middle. | 80 // bar towards the middle. |
| 74 void LayoutPass3(gfx::Rect* bounds, int* available_width); | 81 void LayoutPass3(gfx::Rect* bounds, int* available_width); |
| 75 | 82 |
| 83 // Sets the padding between edit and the decoration beside it. | |
| 84 // This value must not be modified after LayoutPass1 has been called. | |
| 85 void set_item_edit_padding(int item_edit_padding) { | |
| 86 item_edit_padding_ = item_edit_padding; | |
| 87 } | |
| 88 | |
| 76 private: | 89 private: |
| 90 void SetVisibilityForDecorations(int* available_width); | |
| 91 void HideUnneededSeparators(int* available_width); | |
| 92 void SetBoundsForDecorations(gfx::Rect* bounds); | |
| 93 | |
| 77 // LEFT_EDGE means decorations are added from left to right and stacked on | 94 // LEFT_EDGE means decorations are added from left to right and stacked on |
| 78 // the left of the omnibox, RIGHT_EDGE means the opposite. | 95 // the left of the omnibox, RIGHT_EDGE means the opposite. |
| 79 Position position_; | 96 Position position_; |
| 80 | 97 |
| 81 // The padding between the last decoration and the edit box. | 98 // The padding between the last decoration and the edit box. |
| 82 int item_edit_padding_; | 99 int item_edit_padding_; |
| 83 | 100 |
| 84 // The padding between the edge and the edit box, if there are no decorations. | 101 // The padding between the edge and the edit box, if there are no decorations. |
| 85 int edge_edit_padding_; | 102 int edge_edit_padding_; |
| 86 | 103 |
| 87 // The list of decorations to layout. | 104 // The list of decorations to layout. |
| 88 ScopedVector<LocationBarDecoration> decorations_; | 105 ScopedVector<LocationBarDecoration> decorations_; |
| 89 | 106 |
| 90 DISALLOW_COPY_AND_ASSIGN(LocationBarLayout); | 107 DISALLOW_COPY_AND_ASSIGN(LocationBarLayout); |
| 91 }; | 108 }; |
| 92 | 109 |
| 93 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_ | 110 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_ |
| OLD | NEW |