| Index: chrome/browser/chromeos/status/status_area_view.cc
|
| ===================================================================
|
| --- chrome/browser/chromeos/status/status_area_view.cc (revision 44004)
|
| +++ chrome/browser/chromeos/status/status_area_view.cc (working copy)
|
| @@ -15,13 +15,8 @@
|
|
|
| namespace chromeos {
|
|
|
| -// Number of pixels to pad on the left border.
|
| -const int kLeftBorder = 1;
|
| -// Number of pixels to separate the clock from the next item on the right.
|
| -const int kClockSeparation = 4;
|
| -// Number of pixels to separate the language selector from the next item
|
| -// on the right.
|
| -const int kLanguageSeparation = 4;
|
| +// Number of pixels to separate each icon.
|
| +const int kSeparation = 6;
|
|
|
| // BrowserWindowGtk tiles its image with this offset
|
| const int kCustomFrameBackgroundVerticalOffset = 15;
|
| @@ -64,15 +59,14 @@
|
| }
|
|
|
| gfx::Size StatusAreaView::GetPreferredSize() {
|
| - // Start with padding.
|
| - int result_w = kLeftBorder + kClockSeparation + kLanguageSeparation;
|
| + int result_w = kSeparation;
|
| int result_h = 0;
|
| for (int i = 0; i < GetChildViewCount(); i++) {
|
| views::View* cur = GetChildViewAt(i);
|
| if (cur->IsVisible()) {
|
| gfx::Size cur_size = cur->GetPreferredSize();
|
| // Add each width.
|
| - result_w += cur_size.width();
|
| + result_w += cur_size.width() + kSeparation;
|
| // Use max height.
|
| result_h = std::max(result_h, cur_size.height());
|
| }
|
| @@ -81,7 +75,7 @@
|
| }
|
|
|
| void StatusAreaView::Layout() {
|
| - int cur_x = kLeftBorder;
|
| + int cur_x = kSeparation;
|
| for (int i = 0; i < GetChildViewCount(); i++) {
|
| views::View* cur = GetChildViewAt(i);
|
| if (cur->IsVisible()) {
|
| @@ -94,17 +88,19 @@
|
| // Put next in row horizontally, and center vertically.
|
| cur->SetBounds(cur_x, cur_y, cur_size.width(), cur_size.height());
|
|
|
| - cur_x += cur_size.width();
|
| -
|
| - // Buttons have built in padding, but clock and language status don't.
|
| - if (cur == clock_view_)
|
| - cur_x += kClockSeparation;
|
| - else if (cur == language_view_)
|
| - cur_x += kLanguageSeparation;
|
| + cur_x += cur_size.width() + kSeparation;
|
| }
|
| }
|
| }
|
|
|
| +void StatusAreaView::ChildPreferredSizeChanged(View* child) {
|
| + // When something like the clock menu button's size changes, we need to
|
| + // relayout. Also mark that this view's size has changed. This will let
|
| + // BrowserView know to relayout, which will reset the bounds of this view.
|
| + Layout();
|
| + PreferredSizeChanged();
|
| +}
|
| +
|
| // static
|
| StatusAreaView::OpenTabsMode StatusAreaView::GetOpenTabsMode() {
|
| return open_tabs_mode_;
|
|
|