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/common/system/tray/special_popup_row.h" | 5 #include "ash/common/system/tray/special_popup_row.h" |
6 | 6 |
7 #include "ash/common/ash_constants.h" | 7 #include "ash/common/ash_constants.h" |
8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
9 #include "ash/common/system/tray/hover_highlight_view.h" | 9 #include "ash/common/system/tray/hover_highlight_view.h" |
10 #include "ash/common/system/tray/system_menu_button.h" | 10 #include "ash/common/system/tray/system_menu_button.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 views::BoxLayout* box_layout = | 47 views::BoxLayout* box_layout = |
48 new views::BoxLayout(views::BoxLayout::kHorizontal, 4, 0, 0); | 48 new views::BoxLayout(views::BoxLayout::kHorizontal, 4, 0, 0); |
49 box_layout->set_main_axis_alignment( | 49 box_layout->set_main_axis_alignment( |
50 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); | 50 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); |
51 box_layout->set_cross_axis_alignment( | 51 box_layout->set_cross_axis_alignment( |
52 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); | 52 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); |
53 view->SetLayoutManager(box_layout); | 53 view->SetLayoutManager(box_layout); |
54 } else { | 54 } else { |
55 view->SetLayoutManager( | 55 view->SetLayoutManager( |
56 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); | 56 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
57 view->SetBorder(views::Border::CreateEmptyBorder(4, 0, 4, 5)); | 57 view->SetBorder(views::CreateEmptyBorder(4, 0, 4, 5)); |
58 } | 58 } |
59 | 59 |
60 return view; | 60 return view; |
61 } | 61 } |
62 | 62 |
63 } // namespace | 63 } // namespace |
64 | 64 |
65 SpecialPopupRow::SpecialPopupRow() | 65 SpecialPopupRow::SpecialPopupRow() |
66 : views_before_content_container_(nullptr), | 66 : views_before_content_container_(nullptr), |
67 content_(nullptr), | 67 content_(nullptr), |
68 views_after_content_container_(nullptr), | 68 views_after_content_container_(nullptr), |
69 label_(nullptr) { | 69 label_(nullptr) { |
70 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { | 70 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
71 SetBorder(views::Border::CreateSolidSidedBorder(0, 0, kBorderHeight, 0, | 71 SetBorder( |
72 kBorderColor)); | 72 views::CreateSolidSidedBorder(0, 0, kBorderHeight, 0, kBorderColor)); |
73 } else { | 73 } else { |
74 set_background( | 74 set_background( |
75 views::Background::CreateSolidBackground(kHeaderBackgroundColor)); | 75 views::Background::CreateSolidBackground(kHeaderBackgroundColor)); |
76 SetBorder(views::Border::CreateSolidSidedBorder(kBorderHeight, 0, 0, 0, | 76 SetBorder( |
77 kBorderColor)); | 77 views::CreateSolidSidedBorder(kBorderHeight, 0, 0, 0, kBorderColor)); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 SpecialPopupRow::~SpecialPopupRow() {} | 81 SpecialPopupRow::~SpecialPopupRow() {} |
82 | 82 |
83 void SpecialPopupRow::SetTextLabel(int string_id, ViewClickListener* listener) { | 83 void SpecialPopupRow::SetTextLabel(int string_id, ViewClickListener* listener) { |
84 if (MaterialDesignController::IsSystemTrayMenuMaterial()) | 84 if (MaterialDesignController::IsSystemTrayMenuMaterial()) |
85 SetTextLabelMd(string_id, listener); | 85 SetTextLabelMd(string_id, listener); |
86 else | 86 else |
87 SetTextLabelNonMd(string_id, listener); | 87 SetTextLabelNonMd(string_id, listener); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 bool add_separator) { | 234 bool add_separator) { |
235 if (!views_after_content_container_) { | 235 if (!views_after_content_container_) { |
236 views_after_content_container_ = CreateViewContainer(); | 236 views_after_content_container_ = CreateViewContainer(); |
237 AddChildView(views_after_content_container_); | 237 AddChildView(views_after_content_container_); |
238 } | 238 } |
239 | 239 |
240 if (add_separator) { | 240 if (add_separator) { |
241 views::Separator* separator = | 241 views::Separator* separator = |
242 new views::Separator(views::Separator::VERTICAL); | 242 new views::Separator(views::Separator::VERTICAL); |
243 separator->SetColor(ash::kBorderDarkColor); | 243 separator->SetColor(ash::kBorderDarkColor); |
244 separator->SetBorder(views::Border::CreateEmptyBorder(kSeparatorInset, 0, | 244 separator->SetBorder( |
245 kSeparatorInset, 0)); | 245 views::CreateEmptyBorder(kSeparatorInset, 0, kSeparatorInset, 0)); |
246 views_after_content_container_->AddChildView(separator); | 246 views_after_content_container_->AddChildView(separator); |
247 } | 247 } |
248 | 248 |
249 views_after_content_container_->AddChildView(view); | 249 views_after_content_container_->AddChildView(view); |
250 } | 250 } |
251 | 251 |
252 void SpecialPopupRow::SetTextLabelMd(int string_id, | 252 void SpecialPopupRow::SetTextLabelMd(int string_id, |
253 ViewClickListener* listener) { | 253 ViewClickListener* listener) { |
254 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 254 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
255 views::View* container = new views::View; | 255 views::View* container = new views::View; |
(...skipping 23 matching lines...) Expand all Loading... |
279 container->set_highlight_color(SkColorSetARGB(0, 0, 0, 0)); | 279 container->set_highlight_color(SkColorSetARGB(0, 0, 0, 0)); |
280 container->set_default_color(SkColorSetARGB(0, 0, 0, 0)); | 280 container->set_default_color(SkColorSetARGB(0, 0, 0, 0)); |
281 container->set_text_highlight_color(kHeaderTextColorHover); | 281 container->set_text_highlight_color(kHeaderTextColorHover); |
282 container->set_text_default_color(kHeaderTextColorNormal); | 282 container->set_text_default_color(kHeaderTextColorNormal); |
283 | 283 |
284 container->AddIconAndLabel( | 284 container->AddIconAndLabel( |
285 *rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToImageSkia(), | 285 *rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToImageSkia(), |
286 rb.GetLocalizedString(string_id), true /* highlight */); | 286 rb.GetLocalizedString(string_id), true /* highlight */); |
287 | 287 |
288 container->SetBorder( | 288 container->SetBorder( |
289 views::Border::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 0)); | 289 views::CreateEmptyBorder(0, kTrayPopupPaddingHorizontal, 0, 0)); |
290 | 290 |
291 container->SetAccessibleName( | 291 container->SetAccessibleName( |
292 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_PREVIOUS_MENU)); | 292 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_PREVIOUS_MENU)); |
293 SetContent(container); | 293 SetContent(container); |
294 } | 294 } |
295 | 295 |
296 } // namespace ash | 296 } // namespace ash |
OLD | NEW |