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/common/system/tray/tray_item_more.h" | 5 #include "ash/common/system/tray/tray_item_more.h" |
6 | 6 |
7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
8 #include "ash/common/system/tray/fixed_sized_image_view.h" | 8 #include "ash/common/system/tray/fixed_sized_image_view.h" |
9 #include "ash/common/system/tray/system_tray_item.h" | 9 #include "ash/common/system/tray/system_tray_item.h" |
10 #include "ash/common/system/tray/tray_constants.h" | 10 #include "ash/common/system/tray/tray_constants.h" |
| 11 #include "ash/resources/vector_icons/vector_icons.h" |
11 #include "grit/ash_resources.h" | 12 #include "grit/ash_resources.h" |
12 #include "ui/accessibility/ax_view_state.h" | 13 #include "ui/accessibility/ax_view_state.h" |
13 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
14 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
15 #include "ui/gfx/paint_vector_icon.h" | 16 #include "ui/gfx/paint_vector_icon.h" |
16 #include "ui/gfx/vector_icons_public.h" | |
17 #include "ui/views/controls/image_view.h" | 17 #include "ui/views/controls/image_view.h" |
18 #include "ui/views/controls/label.h" | 18 #include "ui/views/controls/label.h" |
19 #include "ui/views/layout/box_layout.h" | 19 #include "ui/views/layout/box_layout.h" |
20 | 20 |
21 namespace ash { | 21 namespace ash { |
22 | 22 |
23 TrayItemMore::TrayItemMore(SystemTrayItem* owner, bool show_more) | 23 TrayItemMore::TrayItemMore(SystemTrayItem* owner, bool show_more) |
24 : owner_(owner), | 24 : owner_(owner), |
25 show_more_(show_more), | 25 show_more_(show_more), |
26 icon_(NULL), | 26 icon_(NULL), |
27 label_(NULL), | 27 label_(NULL), |
28 more_(NULL) { | 28 more_(NULL) { |
29 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, | 29 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, |
30 kTrayPopupPaddingHorizontal, 0, | 30 kTrayPopupPaddingHorizontal, 0, |
31 kTrayPopupPaddingBetweenItems)); | 31 kTrayPopupPaddingBetweenItems)); |
32 | 32 |
33 icon_ = new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT)); | 33 icon_ = new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT)); |
34 AddChildView(icon_); | 34 AddChildView(icon_); |
35 | 35 |
36 label_ = new views::Label; | 36 label_ = new views::Label; |
37 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 37 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
38 AddChildView(label_); | 38 AddChildView(label_); |
39 | 39 |
40 if (show_more) { | 40 if (show_more) { |
41 more_ = new views::ImageView; | 41 more_ = new views::ImageView; |
42 more_->EnableCanvasFlippingForRTLUI(true); | 42 more_->EnableCanvasFlippingForRTLUI(true); |
43 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { | 43 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
44 more_->SetImage(gfx::CreateVectorIcon( | 44 more_->SetImage( |
45 gfx::VectorIconId::SYSTEM_MENU_ARROW_RIGHT, kMenuIconColor)); | 45 gfx::CreateVectorIcon(kSystemMenuArrowRightIcon, kMenuIconColor)); |
46 } else { | 46 } else { |
47 more_->SetImage(ui::ResourceBundle::GetSharedInstance() | 47 more_->SetImage(ui::ResourceBundle::GetSharedInstance() |
48 .GetImageNamed(IDR_AURA_UBER_TRAY_MORE) | 48 .GetImageNamed(IDR_AURA_UBER_TRAY_MORE) |
49 .ToImageSkia()); | 49 .ToImageSkia()); |
50 } | 50 } |
51 AddChildView(more_); | 51 AddChildView(more_); |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 TrayItemMore::~TrayItemMore() {} | 55 TrayItemMore::~TrayItemMore() {} |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 void TrayItemMore::GetAccessibleState(ui::AXViewState* state) { | 109 void TrayItemMore::GetAccessibleState(ui::AXViewState* state) { |
110 ActionableView::GetAccessibleState(state); | 110 ActionableView::GetAccessibleState(state); |
111 if (!accessible_name_.empty()) | 111 if (!accessible_name_.empty()) |
112 state->name = accessible_name_; | 112 state->name = accessible_name_; |
113 } | 113 } |
114 | 114 |
115 } // namespace ash | 115 } // namespace ash |
OLD | NEW |