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

Side by Side Diff: ash/system/chromeos/rotation/tray_rotation_lock.cc

Issue 2316183003: Move a bunch of ash-only vector icons to ash/. (Closed)
Patch Set: drop the "id". Just "icon". It's cleaner. Created 4 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/rotation/tray_rotation_lock.h" 5 #include "ash/system/chromeos/rotation/tray_rotation_lock.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/system_tray.h" 8 #include "ash/common/system/tray/system_tray.h"
9 #include "ash/common/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
10 #include "ash/common/system/tray/tray_item_more.h" 10 #include "ash/common/system/tray/tray_item_more.h"
11 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 11 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
12 #include "ash/common/wm_shell.h" 12 #include "ash/common/wm_shell.h"
13 #include "ash/display/screen_orientation_controller_chromeos.h" 13 #include "ash/display/screen_orientation_controller_chromeos.h"
14 #include "ash/resources/vector_icons/vector_icons.h"
14 #include "ash/shell.h" 15 #include "ash/shell.h"
15 #include "grit/ash_resources.h" 16 #include "grit/ash_resources.h"
16 #include "grit/ash_strings.h" 17 #include "grit/ash_strings.h"
17 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/display/display.h" 20 #include "ui/display/display.h"
20 #include "ui/gfx/paint_vector_icon.h" 21 #include "ui/gfx/paint_vector_icon.h"
21 #include "ui/gfx/vector_icons_public.h"
22 22
23 namespace ash { 23 namespace ash {
24 24
25 namespace tray { 25 namespace tray {
26 26
27 // Extends TrayItemMore, however does not make use of the chevron, nor of the 27 // Extends TrayItemMore, however does not make use of the chevron, nor of the
28 // DetailedView. This was chosen over ActionableView in order to reuse the 28 // DetailedView. This was chosen over ActionableView in order to reuse the
29 // layout and styling of labels and images. This allows RotationLockDefaultView 29 // layout and styling of labels and images. This allows RotationLockDefaultView
30 // to maintain the look of other system tray items without code duplication. 30 // to maintain the look of other system tray items without code duplication.
31 class RotationLockDefaultView : public TrayItemMore, public ShellObserver { 31 class RotationLockDefaultView : public TrayItemMore, public ShellObserver {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 void RotationLockDefaultView::OnMaximizeModeEnded() { 76 void RotationLockDefaultView::OnMaximizeModeEnded() {
77 SetVisible(false); 77 SetVisible(false);
78 } 78 }
79 79
80 void RotationLockDefaultView::UpdateImage() { 80 void RotationLockDefaultView::UpdateImage() {
81 const bool rotation_locked = 81 const bool rotation_locked =
82 Shell::GetInstance()->screen_orientation_controller()->rotation_locked(); 82 Shell::GetInstance()->screen_orientation_controller()->rotation_locked();
83 if (MaterialDesignController::UseMaterialDesignSystemIcons()) { 83 if (MaterialDesignController::UseMaterialDesignSystemIcons()) {
84 const gfx::VectorIconId icon_id = 84 SetImage(gfx::CreateVectorIcon(rotation_locked
85 rotation_locked ? gfx::VectorIconId::SYSTEM_MENU_ROTATION_LOCK_LOCKED 85 ? kSystemMenuRotationLockLockedIcon
86 : gfx::VectorIconId::SYSTEM_MENU_ROTATION_LOCK_AUTO; 86 : kSystemMenuRotationLockAutoIcon,
87 SetImage(gfx::CreateVectorIcon(icon_id, kMenuIconSize, kMenuIconColor)); 87 kMenuIconSize, kMenuIconColor));
88 } else { 88 } else {
89 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 89 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
90 const int resource_id = rotation_locked 90 const int resource_id = rotation_locked
91 ? IDR_AURA_UBER_TRAY_AUTO_ROTATION_LOCKED_DARK 91 ? IDR_AURA_UBER_TRAY_AUTO_ROTATION_LOCKED_DARK
92 : IDR_AURA_UBER_TRAY_AUTO_ROTATION_DARK; 92 : IDR_AURA_UBER_TRAY_AUTO_ROTATION_DARK;
93 SetImage(*bundle.GetImageNamed(resource_id).ToImageSkia()); 93 SetImage(*bundle.GetImageNamed(resource_id).ToImageSkia());
94 } 94 }
95 95
96 base::string16 label = l10n_util::GetStringUTF16( 96 base::string16 label = l10n_util::GetStringUTF16(
97 rotation_locked ? IDS_ASH_STATUS_TRAY_ROTATION_LOCK_LOCKED 97 rotation_locked ? IDS_ASH_STATUS_TRAY_ROTATION_LOCK_LOCKED
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 176
177 void TrayRotationLock::StopObservingShell() { 177 void TrayRotationLock::StopObservingShell() {
178 if (!observing_shell_) 178 if (!observing_shell_)
179 return; 179 return;
180 WmShell::Get()->RemoveShellObserver(this); 180 WmShell::Get()->RemoveShellObserver(this);
181 observing_shell_ = false; 181 observing_shell_ = false;
182 } 182 }
183 183
184 } // namespace ash 184 } // namespace ash
OLDNEW
« no previous file with comments | « ash/resources/vector_icons/system_tray_volume_mute.1x.icon ('k') | ui/gfx/vector_icons/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698