| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "ash/system/tray/tray_views.h" | 5 #include "ash/system/tray/tray_views.h" |
| 6 | 6 |
| 7 #include "ash/system/tray/tray_constants.h" | 7 #include "ash/system/tray/tray_constants.h" |
| 8 #include "ash/system/tray/tray_item_view.h" | 8 #include "ash/system/tray/tray_item_view.h" |
| 9 #include "grit/ash_resources.h" | 9 #include "grit/ash_resources.h" |
| 10 #include "grit/ash_strings.h" | 10 #include "grit/ash_strings.h" |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 gfx::Rect content_bounds = GetContentsBounds(); | 615 gfx::Rect content_bounds = GetContentsBounds(); |
| 616 if (content_bounds.IsEmpty()) | 616 if (content_bounds.IsEmpty()) |
| 617 return; | 617 return; |
| 618 if (!button_container_) { | 618 if (!button_container_) { |
| 619 content_->SetBoundsRect(GetContentsBounds()); | 619 content_->SetBoundsRect(GetContentsBounds()); |
| 620 return; | 620 return; |
| 621 } | 621 } |
| 622 | 622 |
| 623 gfx::Rect bounds(button_container_->GetPreferredSize()); | 623 gfx::Rect bounds(button_container_->GetPreferredSize()); |
| 624 bounds.set_height(content_bounds.height()); | 624 bounds.set_height(content_bounds.height()); |
| 625 bounds = content_bounds.Center(bounds.size()); | 625 gfx::Rect container_bounds = content_bounds; |
| 626 bounds.set_x(content_bounds.width() - bounds.width()); | 626 container_bounds.ClampToCenteredSize(bounds.size()); |
| 627 button_container_->SetBoundsRect(bounds); | 627 container_bounds.set_x(content_bounds.width() - bounds.width()); |
| 628 button_container_->SetBoundsRect(container_bounds); |
| 628 | 629 |
| 629 bounds = content_->bounds(); | 630 bounds = content_->bounds(); |
| 630 bounds.set_width(button_container_->x()); | 631 bounds.set_width(button_container_->x()); |
| 631 content_->SetBoundsRect(bounds); | 632 content_->SetBoundsRect(bounds); |
| 632 } | 633 } |
| 633 | 634 |
| 634 void SetupLabelForTray(views::Label* label) { | 635 void SetupLabelForTray(views::Label* label) { |
| 635 label->SetFont( | 636 label->SetFont( |
| 636 label->font().DeriveFont(2, gfx::Font::BOLD)); | 637 label->font().DeriveFont(2, gfx::Font::BOLD)); |
| 637 label->SetAutoColorReadabilityEnabled(false); | 638 label->SetAutoColorReadabilityEnabled(false); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 tray_view->set_border(views::Border::CreateEmptyBorder( | 671 tray_view->set_border(views::Border::CreateEmptyBorder( |
| 671 kTrayLabelItemVerticalPaddingVeriticalAlignment, | 672 kTrayLabelItemVerticalPaddingVeriticalAlignment, |
| 672 horizontal_padding, | 673 horizontal_padding, |
| 673 kTrayLabelItemVerticalPaddingVeriticalAlignment, | 674 kTrayLabelItemVerticalPaddingVeriticalAlignment, |
| 674 horizontal_padding)); | 675 horizontal_padding)); |
| 675 } | 676 } |
| 676 } | 677 } |
| 677 | 678 |
| 678 } // namespace internal | 679 } // namespace internal |
| 679 } // namespace ash | 680 } // namespace ash |
| OLD | NEW |