| OLD | NEW |
| 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 "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 11 #include "grit/ash_strings.h" | 12 #include "grit/ash_strings.h" |
| 12 #include "grit/ui_resources.h" | 13 #include "grit/ui_resources.h" |
| 13 #include "third_party/skia/include/core/SkCanvas.h" | 14 #include "third_party/skia/include/core/SkCanvas.h" |
| 14 #include "third_party/skia/include/core/SkPaint.h" | 15 #include "third_party/skia/include/core/SkPaint.h" |
| 15 #include "third_party/skia/include/core/SkRect.h" | 16 #include "third_party/skia/include/core/SkRect.h" |
| 16 #include "third_party/skia/include/effects/SkGradientShader.h" | 17 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 18 #include "ui/gfx/canvas.h" | 19 #include "ui/gfx/canvas.h" |
| 19 #include "ui/gfx/image/image.h" | 20 #include "ui/gfx/image/image.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 VolumeView() { | 98 VolumeView() { |
| 98 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, | 99 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, |
| 99 kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingBetweenItems)); | 100 kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingBetweenItems)); |
| 100 | 101 |
| 101 icon_ = new VolumeButton(this); | 102 icon_ = new VolumeButton(this); |
| 102 AddChildView(icon_); | 103 AddChildView(icon_); |
| 103 | 104 |
| 104 ash::SystemTrayDelegate* delegate = | 105 ash::SystemTrayDelegate* delegate = |
| 105 ash::Shell::GetInstance()->tray_delegate(); | 106 ash::Shell::GetInstance()->tray_delegate(); |
| 106 slider_ = new views::Slider(this, views::Slider::HORIZONTAL); | 107 slider_ = new views::Slider(this, views::Slider::HORIZONTAL); |
| 108 slider_->set_focus_color(kFocusBorderColor); |
| 107 slider_->SetValue(delegate->GetVolumeLevel()); | 109 slider_->SetValue(delegate->GetVolumeLevel()); |
| 108 slider_->SetAccessibleName( | 110 slider_->SetAccessibleName( |
| 109 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( | 111 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( |
| 110 IDS_ASH_STATUS_TRAY_VOLUME)); | 112 IDS_ASH_STATUS_TRAY_VOLUME)); |
| 111 AddChildView(slider_); | 113 AddChildView(slider_); |
| 112 } | 114 } |
| 113 | 115 |
| 114 virtual ~VolumeView() {} | 116 virtual ~VolumeView() {} |
| 115 | 117 |
| 116 void SetVolumeLevel(float percent) { | 118 void SetVolumeLevel(float percent) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 if (volume_view_.get()) { | 198 if (volume_view_.get()) { |
| 197 volume_view_->SetVolumeLevel(percent); | 199 volume_view_->SetVolumeLevel(percent); |
| 198 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); | 200 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); |
| 199 return; | 201 return; |
| 200 } | 202 } |
| 201 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); | 203 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); |
| 202 } | 204 } |
| 203 | 205 |
| 204 } // namespace internal | 206 } // namespace internal |
| 205 } // namespace ash | 207 } // namespace ash |
| OLD | NEW |