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

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

Issue 2084533008: mash: Migrate tray audio and deps to common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup IWYU. Created 4 years, 6 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
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/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/metrics/user_metrics_action.h"
9 #include "ash/common/system/audio/tray_audio.h"
10 #include "ash/common/system/audio/tray_audio_delegate.h"
8 #include "ash/common/system/tray/system_tray_item.h" 11 #include "ash/common/system/tray/system_tray_item.h"
9 #include "ash/common/system/tray/tray_constants.h" 12 #include "ash/common/system/tray/tray_constants.h"
10 #include "ash/common/system/tray/tray_popup_item_container.h" 13 #include "ash/common/system/tray/tray_popup_item_container.h"
11 #include "ash/shell.h" 14 #include "ash/common/wm_shell.h"
12 #include "ash/system/audio/tray_audio.h"
13 #include "ash/system/audio/tray_audio_delegate.h"
14 #include "grit/ash_resources.h" 15 #include "grit/ash_resources.h"
15 #include "grit/ash_strings.h" 16 #include "grit/ash_strings.h"
16 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/gfx/canvas.h" 18 #include "ui/gfx/canvas.h"
18 #include "ui/gfx/image/image_skia_operations.h" 19 #include "ui/gfx/image/image_skia_operations.h"
19 #include "ui/views/background.h" 20 #include "ui/views/background.h"
20 #include "ui/views/border.h" 21 #include "ui/views/border.h"
21 #include "ui/views/controls/button/image_button.h" 22 #include "ui/views/controls/button/image_button.h"
22 #include "ui/views/controls/image_view.h" 23 #include "ui/views/controls/image_view.h"
23 #include "ui/views/controls/separator.h" 24 #include "ui/views/controls/separator.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 float value, 246 float value,
246 float old_value, 247 float old_value,
247 views::SliderChangeReason reason) { 248 views::SliderChangeReason reason) {
248 if (reason == views::VALUE_CHANGED_BY_USER) { 249 if (reason == views::VALUE_CHANGED_BY_USER) {
249 float new_volume = value * 100.0f; 250 float new_volume = value * 100.0f;
250 float current_volume = audio_delegate_->GetOutputVolumeLevel(); 251 float current_volume = audio_delegate_->GetOutputVolumeLevel();
251 // Do not call change audio volume if the difference is less than 252 // Do not call change audio volume if the difference is less than
252 // 1%, which is beyond cras audio api's granularity for output volume. 253 // 1%, which is beyond cras audio api's granularity for output volume.
253 if (std::abs(new_volume - current_volume) < 1.0f) 254 if (std::abs(new_volume - current_volume) < 1.0f)
254 return; 255 return;
255 Shell::GetInstance()->metrics()->RecordUserMetricsAction( 256 WmShell::Get()->RecordUserMetricsAction(
256 is_default_view_ ? 257 is_default_view_ ?
257 ash::UMA_STATUS_AREA_CHANGED_VOLUME_MENU : 258 ash::UMA_STATUS_AREA_CHANGED_VOLUME_MENU :
James Cook 2016/06/22 21:27:24 nit: Can you take these out of namespace ash:: whi
msw 2016/06/22 22:16:11 Done.
258 ash::UMA_STATUS_AREA_CHANGED_VOLUME_POPUP); 259 ash::UMA_STATUS_AREA_CHANGED_VOLUME_POPUP);
259 if (new_volume > current_volume) 260 if (new_volume > current_volume)
260 HandleVolumeUp(new_volume); 261 HandleVolumeUp(new_volume);
261 else 262 else
262 HandleVolumeDown(new_volume); 263 HandleVolumeDown(new_volume);
263 } 264 }
264 icon_->Update(); 265 icon_->Update();
265 } 266 }
266 267
267 bool VolumeView::PerformAction(const ui::Event& event) { 268 bool VolumeView::PerformAction(const ui::Event& event) {
(...skipping 10 matching lines...) Expand all
278 separator_->SetSize(gfx::Size(kSeparatorSize, bounds().height())); 279 separator_->SetSize(gfx::Size(kSeparatorSize, bounds().height()));
279 } 280 }
280 281
281 void VolumeView::GetAccessibleState(ui::AXViewState* state) { 282 void VolumeView::GetAccessibleState(ui::AXViewState* state) {
282 // Intentionally overrides ActionableView, leaving |state| unset. A slider 283 // Intentionally overrides ActionableView, leaving |state| unset. A slider
283 // childview exposes accessibility data. 284 // childview exposes accessibility data.
284 } 285 }
285 286
286 } // namespace tray 287 } // namespace tray
287 } // namespace ash 288 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698