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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 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/shell/window_type_launcher.cc ('k') | ash/system/chromeos/network/tray_sms.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 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 gfx::ImageSkia image_skia = gfx::ImageSkiaOperations::ExtractSubset( 66 gfx::ImageSkia image_skia = gfx::ImageSkiaOperations::ExtractSubset(
67 *(image_.ToImageSkia()), region); 67 *(image_.ToImageSkia()), region);
68 SetImage(views::CustomButton::STATE_NORMAL, &image_skia); 68 SetImage(views::CustomButton::STATE_NORMAL, &image_skia);
69 image_index_ = image_index; 69 image_index_ = image_index;
70 } 70 }
71 SchedulePaint(); 71 SchedulePaint();
72 } 72 }
73 73
74 private: 74 private:
75 // Overridden from views::View. 75 // Overridden from views::View.
76 virtual gfx::Size GetPreferredSize() OVERRIDE { 76 virtual gfx::Size GetPreferredSize() const OVERRIDE {
77 gfx::Size size = views::ToggleImageButton::GetPreferredSize(); 77 gfx::Size size = views::ToggleImageButton::GetPreferredSize();
78 size.set_height(kTrayPopupItemHeight); 78 size.set_height(kTrayPopupItemHeight);
79 return size; 79 return size;
80 } 80 }
81 81
82 system::TrayAudioDelegate* audio_delegate_; 82 system::TrayAudioDelegate* audio_delegate_;
83 gfx::Image image_; 83 gfx::Image image_;
84 int image_index_; 84 int image_index_;
85 85
86 DISALLOW_COPY_AND_ASSIGN(VolumeButton); 86 DISALLOW_COPY_AND_ASSIGN(VolumeButton);
(...skipping 25 matching lines...) Expand all
112 DISALLOW_COPY_AND_ASSIGN(VolumeSlider); 112 DISALLOW_COPY_AND_ASSIGN(VolumeSlider);
113 }; 113 };
114 114
115 // Vertical bar separator that can be placed on the VolumeView. 115 // Vertical bar separator that can be placed on the VolumeView.
116 class BarSeparator : public views::View { 116 class BarSeparator : public views::View {
117 public: 117 public:
118 BarSeparator() {} 118 BarSeparator() {}
119 virtual ~BarSeparator() {} 119 virtual ~BarSeparator() {}
120 120
121 // Overriden from views::View. 121 // Overriden from views::View.
122 virtual gfx::Size GetPreferredSize() OVERRIDE { 122 virtual gfx::Size GetPreferredSize() const OVERRIDE {
123 return gfx::Size(kBarSeparatorWidth, kBarSeparatorHeight); 123 return gfx::Size(kBarSeparatorWidth, kBarSeparatorHeight);
124 } 124 }
125 125
126 private: 126 private:
127 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { 127 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
128 canvas->FillRect(gfx::Rect(width() / 2, 0, 1, height()), 128 canvas->FillRect(gfx::Rect(width() / 2, 0, 1, height()),
129 kButtonStrokeColor); 129 kButtonStrokeColor);
130 } 130 }
131 131
132 DISALLOW_COPY_AND_ASSIGN(BarSeparator); 132 DISALLOW_COPY_AND_ASSIGN(BarSeparator);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 bool VolumeView::PerformAction(const ui::Event& event) { 322 bool VolumeView::PerformAction(const ui::Event& event) {
323 if (!more_->visible()) 323 if (!more_->visible())
324 return false; 324 return false;
325 owner_->TransitionDetailedView(); 325 owner_->TransitionDetailedView();
326 return true; 326 return true;
327 } 327 }
328 328
329 } // namespace tray 329 } // namespace tray
330 } // namespace ash 330 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell/window_type_launcher.cc ('k') | ash/system/chromeos/network/tray_sms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698