OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/chromeos/brightness/tray_brightness.h" | 5 #include "ash/common/system/chromeos/brightness/tray_brightness.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/common/material_design/material_design_controller.h" | |
10 #include "ash/common/shell_observer.h" | 9 #include "ash/common/shell_observer.h" |
11 #include "ash/common/system/brightness_control_delegate.h" | 10 #include "ash/common/system/brightness_control_delegate.h" |
12 #include "ash/common/system/tray/tray_constants.h" | 11 #include "ash/common/system/tray/tray_constants.h" |
13 #include "ash/common/system/tray/tray_popup_utils.h" | 12 #include "ash/common/system/tray/tray_popup_utils.h" |
14 #include "ash/common/system/tray/tri_view.h" | 13 #include "ash/common/system/tray/tri_view.h" |
15 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 14 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
16 #include "ash/common/wm_shell.h" | 15 #include "ash/common/wm_shell.h" |
17 #include "ash/resources/grit/ash_resources.h" | 16 #include "ash/resources/grit/ash_resources.h" |
18 #include "ash/resources/vector_icons/vector_icons.h" | 17 #include "ash/resources/vector_icons/vector_icons.h" |
19 #include "ash/shell.h" | 18 #include "ash/shell.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 last_percent_(initial_percent) { | 95 last_percent_(initial_percent) { |
97 SetLayoutManager(new views::FillLayout); | 96 SetLayoutManager(new views::FillLayout); |
98 // Use CreateMultiTargetRowView() instead of CreateDefaultRowView() because | 97 // Use CreateMultiTargetRowView() instead of CreateDefaultRowView() because |
99 // that's what the audio row uses and we want the two rows to layout with the | 98 // that's what the audio row uses and we want the two rows to layout with the |
100 // same insets. | 99 // same insets. |
101 TriView* tri_view = TrayPopupUtils::CreateMultiTargetRowView(); | 100 TriView* tri_view = TrayPopupUtils::CreateMultiTargetRowView(); |
102 AddChildView(tri_view); | 101 AddChildView(tri_view); |
103 | 102 |
104 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 103 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
105 views::ImageView* icon = TrayPopupUtils::CreateMainImageView(); | 104 views::ImageView* icon = TrayPopupUtils::CreateMainImageView(); |
106 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { | 105 icon->SetImage( |
107 icon->SetImage( | 106 gfx::CreateVectorIcon(kSystemMenuBrightnessIcon, kMenuIconColor)); |
108 gfx::CreateVectorIcon(kSystemMenuBrightnessIcon, kMenuIconColor)); | |
109 } else { | |
110 icon->SetImage( | |
111 rb.GetImageNamed(IDR_AURA_UBER_TRAY_BRIGHTNESS).ToImageSkia()); | |
112 } | |
113 tri_view->AddView(TriView::Container::START, icon); | 107 tri_view->AddView(TriView::Container::START, icon); |
114 | 108 |
115 slider_ = TrayPopupUtils::CreateSlider(this); | 109 slider_ = TrayPopupUtils::CreateSlider(this); |
116 slider_->SetValue(static_cast<float>(initial_percent / 100.0)); | 110 slider_->SetValue(static_cast<float>(initial_percent / 100.0)); |
117 slider_->SetAccessibleName( | 111 slider_->SetAccessibleName( |
118 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_BRIGHTNESS)); | 112 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_BRIGHTNESS)); |
119 tri_view->AddView(TriView::Container::CENTER, slider_); | 113 tri_view->AddView(TriView::Container::CENTER, slider_); |
120 | 114 |
121 if (is_default_view_) { | 115 if (is_default_view_) { |
122 Shell::GetInstance()->AddShellObserver(this); | 116 Shell::GetInstance()->AddShellObserver(this); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 if (!display::Display::HasInternalDisplay()) | 269 if (!display::Display::HasInternalDisplay()) |
276 return; | 270 return; |
277 | 271 |
278 if (brightness_view_ && brightness_view_->visible()) | 272 if (brightness_view_ && brightness_view_->visible()) |
279 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); | 273 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); |
280 else | 274 else |
281 ShowDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); | 275 ShowDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); |
282 } | 276 } |
283 | 277 |
284 } // namespace ash | 278 } // namespace ash |
OLD | NEW |