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

Side by Side Diff: ash/system/audio/tray_volume.cc

Issue 10382144: Change SetImage, SetBackground, and SetToggledImage to take in a gfx::ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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/monitor/secondary_monitor_view.cc ('k') | ash/system/bluetooth/tray_bluetooth.cc » ('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 (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/audio/tray_volume.h" 5 #include "ash/system/audio/tray_volume.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray_delegate.h" 8 #include "ash/system/tray/system_tray_delegate.h"
9 #include "ash/system/tray/tray_constants.h" 9 #include "ash/system/tray/tray_constants.h"
10 #include "ash/system/tray/tray_views.h" 10 #include "ash/system/tray/tray_views.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 else if (image_index == kVolumeLevel - 1) 62 else if (image_index == kVolumeLevel - 1)
63 --image_index; 63 --image_index;
64 // Index 0 is reserved for mute. 64 // Index 0 is reserved for mute.
65 if (delegate->IsAudioMuted()) 65 if (delegate->IsAudioMuted())
66 image_index = 0; 66 image_index = 0;
67 else 67 else
68 ++image_index; 68 ++image_index;
69 if (image_index != image_index_) { 69 if (image_index != image_index_) {
70 SkIRect region = SkIRect::MakeXYWH(0, image_index * kVolumeImageHeight, 70 SkIRect region = SkIRect::MakeXYWH(0, image_index * kVolumeImageHeight,
71 kVolumeImageWidth, kVolumeImageHeight); 71 kVolumeImageWidth, kVolumeImageHeight);
72 SkBitmap bitmap; 72 gfx::ImageSkia image_skia;
sky 2012/05/14 14:29:22 Code like this isn't going to update when the dpi
pkotwicz 2012/05/14 18:04:05 That's correct unfortunately.
73 image_.ToSkBitmap()->extractSubset(&bitmap, region); 73 image_.ToImageSkia()->extractSubset(&image_skia, region);
74 SetImage(views::CustomButton::BS_NORMAL, &bitmap); 74 SetImage(views::CustomButton::BS_NORMAL, &image_skia);
75 image_index_ = image_index; 75 image_index_ = image_index;
76 } 76 }
77 SchedulePaint(); 77 SchedulePaint();
78 } 78 }
79 79
80 private: 80 private:
81 // Overridden from views::View. 81 // Overridden from views::View.
82 virtual gfx::Size GetPreferredSize() OVERRIDE { 82 virtual gfx::Size GetPreferredSize() OVERRIDE {
83 gfx::Size size = views::ToggleImageButton::GetPreferredSize(); 83 gfx::Size size = views::ToggleImageButton::GetPreferredSize();
84 size.set_height(kTrayPopupItemHeight); 84 size.set_height(kTrayPopupItemHeight);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 if (volume_view_) { 203 if (volume_view_) {
204 volume_view_->SetVolumeLevel(percent); 204 volume_view_->SetVolumeLevel(percent);
205 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); 205 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds);
206 return; 206 return;
207 } 207 }
208 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); 208 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false);
209 } 209 }
210 210
211 } // namespace internal 211 } // namespace internal
212 } // namespace ash 212 } // namespace ash
OLDNEW
« no previous file with comments | « ash/monitor/secondary_monitor_view.cc ('k') | ash/system/bluetooth/tray_bluetooth.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698