| OLD | NEW |
| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 gfx::ImageSkia image_skia = gfx::ImageSkiaOperations::ExtractSubset( | 65 gfx::ImageSkia image_skia = gfx::ImageSkiaOperations::ExtractSubset( |
| 66 *(image_.ToImageSkia()), region); | 66 *(image_.ToImageSkia()), region); |
| 67 SetImage(views::CustomButton::STATE_NORMAL, &image_skia); | 67 SetImage(views::CustomButton::STATE_NORMAL, &image_skia); |
| 68 image_index_ = image_index; | 68 image_index_ = image_index; |
| 69 } | 69 } |
| 70 SchedulePaint(); | 70 SchedulePaint(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 // Overridden from views::View. | 74 // Overridden from views::View. |
| 75 virtual gfx::Size GetPreferredSize() const OVERRIDE { | 75 virtual gfx::Size GetPreferredSize() const override { |
| 76 gfx::Size size = views::ToggleImageButton::GetPreferredSize(); | 76 gfx::Size size = views::ToggleImageButton::GetPreferredSize(); |
| 77 size.set_height(kTrayPopupItemHeight); | 77 size.set_height(kTrayPopupItemHeight); |
| 78 return size; | 78 return size; |
| 79 } | 79 } |
| 80 | 80 |
| 81 system::TrayAudioDelegate* audio_delegate_; | 81 system::TrayAudioDelegate* audio_delegate_; |
| 82 gfx::Image image_; | 82 gfx::Image image_; |
| 83 int image_index_; | 83 int image_index_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(VolumeButton); | 85 DISALLOW_COPY_AND_ASSIGN(VolumeButton); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 111 DISALLOW_COPY_AND_ASSIGN(VolumeSlider); | 111 DISALLOW_COPY_AND_ASSIGN(VolumeSlider); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 // Vertical bar separator that can be placed on the VolumeView. | 114 // Vertical bar separator that can be placed on the VolumeView. |
| 115 class BarSeparator : public views::View { | 115 class BarSeparator : public views::View { |
| 116 public: | 116 public: |
| 117 BarSeparator() {} | 117 BarSeparator() {} |
| 118 virtual ~BarSeparator() {} | 118 virtual ~BarSeparator() {} |
| 119 | 119 |
| 120 // Overriden from views::View. | 120 // Overriden from views::View. |
| 121 virtual gfx::Size GetPreferredSize() const OVERRIDE { | 121 virtual gfx::Size GetPreferredSize() const override { |
| 122 return gfx::Size(kBarSeparatorWidth, kBarSeparatorHeight); | 122 return gfx::Size(kBarSeparatorWidth, kBarSeparatorHeight); |
| 123 } | 123 } |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 126 virtual void OnPaint(gfx::Canvas* canvas) override { |
| 127 canvas->FillRect(gfx::Rect(width() / 2, 0, 1, height()), | 127 canvas->FillRect(gfx::Rect(width() / 2, 0, 1, height()), |
| 128 kButtonStrokeColor); | 128 kButtonStrokeColor); |
| 129 } | 129 } |
| 130 | 130 |
| 131 DISALLOW_COPY_AND_ASSIGN(BarSeparator); | 131 DISALLOW_COPY_AND_ASSIGN(BarSeparator); |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 VolumeView::VolumeView(SystemTrayItem* owner, | 134 VolumeView::VolumeView(SystemTrayItem* owner, |
| 135 system::TrayAudioDelegate* audio_delegate, | 135 system::TrayAudioDelegate* audio_delegate, |
| 136 bool is_default_view) | 136 bool is_default_view) |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 320 |
| 321 bool VolumeView::PerformAction(const ui::Event& event) { | 321 bool VolumeView::PerformAction(const ui::Event& event) { |
| 322 if (!more_->visible()) | 322 if (!more_->visible()) |
| 323 return false; | 323 return false; |
| 324 owner_->TransitionDetailedView(); | 324 owner_->TransitionDetailedView(); |
| 325 return true; | 325 return true; |
| 326 } | 326 } |
| 327 | 327 |
| 328 } // namespace tray | 328 } // namespace tray |
| 329 } // namespace ash | 329 } // namespace ash |
| OLD | NEW |