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

Side by Side Diff: ash/system/power/tray_power.cc

Issue 12259007: Adjust battery image assets to better align in ash tray. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ash/resources/default_200_percent/cros/status/status_power_small_all_dark.png ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/system/power/tray_power.h" 5 #include "ash/system/power/tray_power.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/system/date/date_view.h" 9 #include "ash/system/date/date_view.h"
10 #include "ash/system/power/power_status_view.h" 10 #include "ash/system/power/power_status_view.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 return (image_index << 1) | (supply_status.line_power_on ? 1 : 0); 161 return (image_index << 1) | (supply_status.line_power_on ? 1 : 0);
162 } 162 }
163 163
164 // static 164 // static
165 gfx::ImageSkia TrayPower::GetBatteryImage(int image_index, IconSet icon_set) { 165 gfx::ImageSkia TrayPower::GetBatteryImage(int image_index, IconSet icon_set) {
166 gfx::Image all = ui::ResourceBundle::GetSharedInstance().GetImageNamed( 166 gfx::Image all = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
167 icon_set == ICON_DARK ? 167 icon_set == ICON_DARK ?
168 IDR_AURA_UBER_TRAY_POWER_SMALL_DARK : IDR_AURA_UBER_TRAY_POWER_SMALL); 168 IDR_AURA_UBER_TRAY_POWER_SMALL_DARK : IDR_AURA_UBER_TRAY_POWER_SMALL);
169 169
170 // TODO(mbolohan): Remove the 2px offset when the assets are centered. See
171 // crbug.com/119832.
172 gfx::Rect region( 170 gfx::Rect region(
173 ((image_index & 0x1) ? kBatteryImageWidth : 0) + 2, 171 (image_index & 0x1) ? kBatteryImageWidth : 0,
174 (image_index >> 1) * kBatteryImageHeight, 172 (image_index >> 1) * kBatteryImageHeight,
175 kBatteryImageWidth - 2, kBatteryImageHeight); 173 kBatteryImageWidth, kBatteryImageHeight);
176 return gfx::ImageSkiaOperations::ExtractSubset(*all.ToImageSkia(), region); 174 return gfx::ImageSkiaOperations::ExtractSubset(*all.ToImageSkia(), region);
177 } 175 }
178 176
179 views::View* TrayPower::CreateTrayView(user::LoginStatus status) { 177 views::View* TrayPower::CreateTrayView(user::LoginStatus status) {
180 // There may not be enough information when this is created about whether 178 // There may not be enough information when this is created about whether
181 // there is a battery or not. So always create this, and adjust visibility as 179 // there is a battery or not. So always create this, and adjust visibility as
182 // necessary. 180 // necessary.
183 PowerSupplyStatus power_status = 181 PowerSupplyStatus power_status =
184 ash::Shell::GetInstance()->system_tray_delegate()->GetPowerSupplyStatus(); 182 ash::Shell::GetInstance()->system_tray_delegate()->GetPowerSupplyStatus();
185 CHECK(power_tray_ == NULL); 183 CHECK(power_tray_ == NULL);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 return false; 267 return false;
270 case NOTIFICATION_CRITICAL: 268 case NOTIFICATION_CRITICAL:
271 return false; 269 return false;
272 } 270 }
273 NOTREACHED(); 271 NOTREACHED();
274 return false; 272 return false;
275 } 273 }
276 274
277 } // namespace internal 275 } // namespace internal
278 } // namespace ash 276 } // namespace ash
OLDNEW
« no previous file with comments | « ash/resources/default_200_percent/cros/status/status_power_small_all_dark.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698