| 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/common/system/audio/volume_view.h" | 5 #include "ash/common/system/audio/volume_view.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_constants.h" | 7 #include "ash/common/ash_constants.h" |
| 8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
| 9 #include "ash/common/metrics/user_metrics_action.h" | 9 #include "ash/common/metrics/user_metrics_action.h" |
| 10 #include "ash/common/system/audio/tray_audio.h" | 10 #include "ash/common/system/audio/tray_audio.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 system::TrayAudioDelegate* audio_delegate_; | 116 system::TrayAudioDelegate* audio_delegate_; |
| 117 gfx::Image image_; | 117 gfx::Image image_; |
| 118 int image_index_; | 118 int image_index_; |
| 119 | 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(VolumeButton); | 120 DISALLOW_COPY_AND_ASSIGN(VolumeButton); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 VolumeView::VolumeView(SystemTrayItem* owner, | 123 VolumeView::VolumeView(SystemTrayItem* owner, |
| 124 system::TrayAudioDelegate* audio_delegate, | 124 system::TrayAudioDelegate* audio_delegate, |
| 125 bool is_default_view) | 125 bool is_default_view) |
| 126 : owner_(owner), | 126 : ActionableView(owner), |
| 127 audio_delegate_(audio_delegate), | 127 audio_delegate_(audio_delegate), |
| 128 icon_(NULL), | 128 icon_(NULL), |
| 129 slider_(NULL), | 129 slider_(NULL), |
| 130 device_type_(NULL), | 130 device_type_(NULL), |
| 131 more_(NULL), | 131 more_(NULL), |
| 132 is_default_view_(is_default_view) { | 132 is_default_view_(is_default_view) { |
| 133 SetFocusBehavior(FocusBehavior::NEVER); | 133 SetFocusBehavior(FocusBehavior::NEVER); |
| 134 views::BoxLayout* box_layout = new views::BoxLayout( | 134 views::BoxLayout* box_layout = new views::BoxLayout( |
| 135 views::BoxLayout::kHorizontal, 0, 0, kBoxLayoutPadding); | 135 views::BoxLayout::kHorizontal, 0, 0, kBoxLayoutPadding); |
| 136 box_layout->SetDefaultFlex(0); | 136 box_layout->SetDefaultFlex(0); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 HandleVolumeUp(new_volume); | 294 HandleVolumeUp(new_volume); |
| 295 else | 295 else |
| 296 HandleVolumeDown(new_volume); | 296 HandleVolumeDown(new_volume); |
| 297 } | 297 } |
| 298 icon_->Update(); | 298 icon_->Update(); |
| 299 } | 299 } |
| 300 | 300 |
| 301 bool VolumeView::PerformAction(const ui::Event& event) { | 301 bool VolumeView::PerformAction(const ui::Event& event) { |
| 302 if (!more_region_->visible()) | 302 if (!more_region_->visible()) |
| 303 return false; | 303 return false; |
| 304 owner_->TransitionDetailedView(); | 304 owner()->TransitionDetailedView(); |
| 305 return true; | 305 return true; |
| 306 } | 306 } |
| 307 | 307 |
| 308 void VolumeView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 308 void VolumeView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| 309 // Separator's prefered size is based on set bounds. When an empty bounds is | 309 // Separator's prefered size is based on set bounds. When an empty bounds is |
| 310 // set on first layout this causes BoxLayout to ignore the separator. Reset | 310 // set on first layout this causes BoxLayout to ignore the separator. Reset |
| 311 // its height on each bounds change so that it is laid out properly. | 311 // its height on each bounds change so that it is laid out properly. |
| 312 separator_->SetSize(gfx::Size(kSeparatorSize, bounds().height())); | 312 separator_->SetSize(gfx::Size(kSeparatorSize, bounds().height())); |
| 313 } | 313 } |
| 314 | 314 |
| 315 void VolumeView::GetAccessibleState(ui::AXViewState* state) { | 315 void VolumeView::GetAccessibleState(ui::AXViewState* state) { |
| 316 // Intentionally overrides ActionableView, leaving |state| unset. A slider | 316 // Intentionally overrides ActionableView, leaving |state| unset. A slider |
| 317 // childview exposes accessibility data. | 317 // childview exposes accessibility data. |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace tray | 320 } // namespace tray |
| 321 } // namespace ash | 321 } // namespace ash |
| OLD | NEW |