Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1276)

Side by Side Diff: ash/common/system/chromeos/brightness/tray_brightness.cc

Issue 2776973005: Revert of Remove some pre-md code and assets. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/BUILD.gn ('k') | ash/common/system/chromeos/power/power_status.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
9 #include "ash/common/shell_observer.h" 10 #include "ash/common/shell_observer.h"
10 #include "ash/common/system/brightness_control_delegate.h" 11 #include "ash/common/system/brightness_control_delegate.h"
11 #include "ash/common/system/tray/tray_constants.h" 12 #include "ash/common/system/tray/tray_constants.h"
12 #include "ash/common/system/tray/tray_popup_utils.h" 13 #include "ash/common/system/tray/tray_popup_utils.h"
13 #include "ash/common/system/tray/tri_view.h" 14 #include "ash/common/system/tray/tri_view.h"
14 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 15 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
15 #include "ash/common/wm_shell.h" 16 #include "ash/common/wm_shell.h"
16 #include "ash/resources/grit/ash_resources.h" 17 #include "ash/resources/grit/ash_resources.h"
17 #include "ash/resources/vector_icons/vector_icons.h" 18 #include "ash/resources/vector_icons/vector_icons.h"
18 #include "ash/shell.h" 19 #include "ash/shell.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 last_percent_(initial_percent) { 96 last_percent_(initial_percent) {
96 SetLayoutManager(new views::FillLayout); 97 SetLayoutManager(new views::FillLayout);
97 // Use CreateMultiTargetRowView() instead of CreateDefaultRowView() because 98 // Use CreateMultiTargetRowView() instead of CreateDefaultRowView() because
98 // that's what the audio row uses and we want the two rows to layout with the 99 // that's what the audio row uses and we want the two rows to layout with the
99 // same insets. 100 // same insets.
100 TriView* tri_view = TrayPopupUtils::CreateMultiTargetRowView(); 101 TriView* tri_view = TrayPopupUtils::CreateMultiTargetRowView();
101 AddChildView(tri_view); 102 AddChildView(tri_view);
102 103
103 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 104 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
104 views::ImageView* icon = TrayPopupUtils::CreateMainImageView(); 105 views::ImageView* icon = TrayPopupUtils::CreateMainImageView();
105 icon->SetImage( 106 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
106 gfx::CreateVectorIcon(kSystemMenuBrightnessIcon, kMenuIconColor)); 107 icon->SetImage(
108 gfx::CreateVectorIcon(kSystemMenuBrightnessIcon, kMenuIconColor));
109 } else {
110 icon->SetImage(
111 rb.GetImageNamed(IDR_AURA_UBER_TRAY_BRIGHTNESS).ToImageSkia());
112 }
107 tri_view->AddView(TriView::Container::START, icon); 113 tri_view->AddView(TriView::Container::START, icon);
108 114
109 slider_ = TrayPopupUtils::CreateSlider(this); 115 slider_ = TrayPopupUtils::CreateSlider(this);
110 slider_->SetValue(static_cast<float>(initial_percent / 100.0)); 116 slider_->SetValue(static_cast<float>(initial_percent / 100.0));
111 slider_->SetAccessibleName( 117 slider_->SetAccessibleName(
112 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_BRIGHTNESS)); 118 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_BRIGHTNESS));
113 tri_view->AddView(TriView::Container::CENTER, slider_); 119 tri_view->AddView(TriView::Container::CENTER, slider_);
114 120
115 if (is_default_view_) { 121 if (is_default_view_) {
116 Shell::GetInstance()->AddShellObserver(this); 122 Shell::GetInstance()->AddShellObserver(this);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 if (!display::Display::HasInternalDisplay()) 275 if (!display::Display::HasInternalDisplay())
270 return; 276 return;
271 277
272 if (brightness_view_ && brightness_view_->visible()) 278 if (brightness_view_ && brightness_view_->visible())
273 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); 279 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds);
274 else 280 else
275 ShowDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); 281 ShowDetailedView(kTrayPopupAutoCloseDelayInSeconds, false);
276 } 282 }
277 283
278 } // namespace ash 284 } // namespace ash
OLDNEW
« no previous file with comments | « ash/BUILD.gn ('k') | ash/common/system/chromeos/power/power_status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698