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

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

Issue 583843003: views::ImageButton: Added SetMinimumImageSize; removed SetPreferredSize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to sky's comments. Created 6 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
« no previous file with comments | « no previous file | ui/app_list/views/contents_switcher_view.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 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/audio/volume_view.h" 5 #include "ash/system/audio/volume_view.h"
6 6
7 #include "ash/ash_constants.h" 7 #include "ash/ash_constants.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/system/audio/tray_audio.h" 9 #include "ash/system/audio/tray_audio.h"
10 #include "ash/system/audio/tray_audio_delegate.h" 10 #include "ash/system/audio/tray_audio_delegate.h"
(...skipping 29 matching lines...) Expand all
40 class VolumeButton : public views::ToggleImageButton { 40 class VolumeButton : public views::ToggleImageButton {
41 public: 41 public:
42 VolumeButton(views::ButtonListener* listener, 42 VolumeButton(views::ButtonListener* listener,
43 system::TrayAudioDelegate* audio_delegate) 43 system::TrayAudioDelegate* audio_delegate)
44 : views::ToggleImageButton(listener), 44 : views::ToggleImageButton(listener),
45 audio_delegate_(audio_delegate), 45 audio_delegate_(audio_delegate),
46 image_index_(-1) { 46 image_index_(-1) {
47 SetImageAlignment(ALIGN_CENTER, ALIGN_MIDDLE); 47 SetImageAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
48 image_ = ui::ResourceBundle::GetSharedInstance().GetImageNamed( 48 image_ = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
49 IDR_AURA_UBER_TRAY_VOLUME_LEVELS); 49 IDR_AURA_UBER_TRAY_VOLUME_LEVELS);
50 SetPreferredSize(gfx::Size(kTrayPopupItemHeight, kTrayPopupItemHeight));
51 Update(); 50 Update();
52 } 51 }
53 52
54 virtual ~VolumeButton() {} 53 virtual ~VolumeButton() {}
55 54
56 void Update() { 55 void Update() {
57 float level = 56 float level =
58 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f; 57 static_cast<float>(audio_delegate_->GetOutputVolumeLevel()) / 100.0f;
59 int image_index = audio_delegate_->IsOutputAudioMuted() ? 58 int image_index = audio_delegate_->IsOutputAudioMuted() ?
60 0 : (level == 1.0 ? 59 0 : (level == 1.0 ?
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 320
322 bool VolumeView::PerformAction(const ui::Event& event) { 321 bool VolumeView::PerformAction(const ui::Event& event) {
323 if (!more_->visible()) 322 if (!more_->visible())
324 return false; 323 return false;
325 owner_->TransitionDetailedView(); 324 owner_->TransitionDetailedView();
326 return true; 325 return true;
327 } 326 }
328 327
329 } // namespace tray 328 } // namespace tray
330 } // namespace ash 329 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/views/contents_switcher_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698