OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "ash/system/tray/special_popup_row.h" | 5 #include "ash/system/tray/special_popup_row.h" |
6 | 6 |
7 #include "ash/system/tray/hover_highlight_view.h" | 7 #include "ash/system/tray/hover_highlight_view.h" |
8 #include "ash/system/tray/throbber_view.h" | 8 #include "ash/system/tray/throbber_view.h" |
9 #include "ash/system/tray/tray_constants.h" | 9 #include "ash/system/tray/tray_constants.h" |
10 #include "ash/system/tray/tray_popup_header_button.h" | 10 #include "ash/system/tray/tray_popup_header_button.h" |
11 #include "grit/ash_resources.h" | 11 #include "grit/ash_resources.h" |
12 #include "grit/ash_strings.h" | 12 #include "grit/ash_strings.h" |
13 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
14 #include "ui/gfx/canvas.h" | 14 #include "ui/gfx/canvas.h" |
| 15 #include "ui/gfx/geometry/insets.h" |
15 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
16 #include "ui/views/background.h" | 17 #include "ui/views/background.h" |
17 #include "ui/views/border.h" | 18 #include "ui/views/border.h" |
| 19 #include "ui/views/controls/separator.h" |
18 #include "ui/views/layout/box_layout.h" | 20 #include "ui/views/layout/box_layout.h" |
19 #include "ui/views/painter.h" | 21 #include "ui/views/painter.h" |
20 | 22 |
21 namespace ash { | 23 namespace ash { |
22 namespace { | 24 namespace { |
23 | 25 |
24 const int kIconPaddingLeft = 5; | 26 const int kIconPaddingLeft = 5; |
| 27 const int kSeparatorInset = 10; |
25 const int kSpecialPopupRowHeight = 55; | 28 const int kSpecialPopupRowHeight = 55; |
26 const int kBorderHeight = 1; | 29 const int kBorderHeight = 1; |
27 const SkColor kBorderColor = SkColorSetRGB(0xaa, 0xaa, 0xaa); | 30 const SkColor kBorderColor = SkColorSetRGB(0xaa, 0xaa, 0xaa); |
28 | 31 |
29 views::View* CreatePopupHeaderButtonsContainer() { | 32 views::View* CreatePopupHeaderButtonsContainer() { |
30 views::View* view = new views::View; | 33 views::View* view = new views::View; |
31 view->SetLayoutManager(new | 34 view->SetLayoutManager( |
32 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, -1)); | 35 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
33 view->SetBorder(views::Border::CreateEmptyBorder(0, 0, 0, 5)); | 36 view->SetBorder(views::Border::CreateEmptyBorder(4, 0, 4, 5)); |
34 return view; | 37 return view; |
35 } | 38 } |
36 | 39 |
37 } // namespace | 40 } // namespace |
38 | 41 |
39 SpecialPopupRow::SpecialPopupRow() | 42 SpecialPopupRow::SpecialPopupRow() |
40 : content_(NULL), | 43 : content_(NULL), |
41 button_container_(NULL) { | 44 button_container_(NULL) { |
42 set_background(views::Background::CreateSolidBackground( | 45 set_background(views::Background::CreateSolidBackground( |
43 kHeaderBackgroundColor)); | 46 kHeaderBackgroundColor)); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 CHECK(!content_); | 81 CHECK(!content_); |
79 content_ = view; | 82 content_ = view; |
80 AddChildViewAt(content_, 0); | 83 AddChildViewAt(content_, 0); |
81 } | 84 } |
82 | 85 |
83 void SpecialPopupRow::AddButton(TrayPopupHeaderButton* button) { | 86 void SpecialPopupRow::AddButton(TrayPopupHeaderButton* button) { |
84 if (!button_container_) { | 87 if (!button_container_) { |
85 button_container_ = CreatePopupHeaderButtonsContainer(); | 88 button_container_ = CreatePopupHeaderButtonsContainer(); |
86 AddChildView(button_container_); | 89 AddChildView(button_container_); |
87 } | 90 } |
| 91 views::Separator* separator = |
| 92 new views::Separator(views::Separator::VERTICAL); |
| 93 separator->SetColor(ash::kBorderDarkColor); |
| 94 separator->SetBorder( |
| 95 views::Border::CreateEmptyBorder(kSeparatorInset, 0, kSeparatorInset, 0)); |
| 96 button_container_->AddChildView(separator); |
88 button_container_->AddChildView(button); | 97 button_container_->AddChildView(button); |
89 } | 98 } |
90 | 99 |
91 void SpecialPopupRow::AddThrobber(ThrobberView* throbber) { | 100 void SpecialPopupRow::AddThrobber(ThrobberView* throbber) { |
92 if (!button_container_) { | 101 if (!button_container_) { |
93 button_container_ = CreatePopupHeaderButtonsContainer(); | 102 button_container_ = CreatePopupHeaderButtonsContainer(); |
94 AddChildView(button_container_); | 103 AddChildView(button_container_); |
95 } | 104 } |
96 button_container_->AddChildView(throbber); | 105 button_container_->AddChildView(throbber); |
97 } | 106 } |
(...skipping 24 matching lines...) Expand all Loading... |
122 container_bounds.ClampToCenteredSize(bounds.size()); | 131 container_bounds.ClampToCenteredSize(bounds.size()); |
123 container_bounds.set_x(content_bounds.width() - container_bounds.width()); | 132 container_bounds.set_x(content_bounds.width() - container_bounds.width()); |
124 button_container_->SetBoundsRect(container_bounds); | 133 button_container_->SetBoundsRect(container_bounds); |
125 | 134 |
126 bounds = content_->bounds(); | 135 bounds = content_->bounds(); |
127 bounds.set_width(button_container_->x()); | 136 bounds.set_width(button_container_->x()); |
128 content_->SetBoundsRect(bounds); | 137 content_->SetBoundsRect(bounds); |
129 } | 138 } |
130 | 139 |
131 } // namespace ash | 140 } // namespace ash |
OLD | NEW |