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

Side by Side Diff: ash/system/chromeos/brightness/tray_brightness.cc

Issue 2099443002: Migrate simple ash Shell metrics users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win compile error. 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/brightness/tray_brightness.h" 5 #include "ash/system/chromeos/brightness/tray_brightness.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/accelerators/accelerator_controller.h" 9 #include "ash/accelerators/accelerator_controller.h"
10 #include "ash/common/ash_constants.h" 10 #include "ash/common/ash_constants.h"
11 #include "ash/common/shell_observer.h" 11 #include "ash/common/shell_observer.h"
12 #include "ash/common/system/tray/fixed_sized_image_view.h" 12 #include "ash/common/system/tray/fixed_sized_image_view.h"
13 #include "ash/common/system/tray/system_tray_delegate.h" 13 #include "ash/common/system/tray/system_tray_delegate.h"
14 #include "ash/common/system/tray/tray_constants.h" 14 #include "ash/common/system/tray/tray_constants.h"
15 #include "ash/common/wm_shell.h" 15 #include "ash/common/wm_shell.h"
16 #include "ash/metrics/user_metrics_recorder.h"
17 #include "ash/shell.h" 16 #include "ash/shell.h"
18 #include "ash/system/brightness_control_delegate.h" 17 #include "ash/system/brightness_control_delegate.h"
19 #include "ash/system/tray/system_tray_notifier.h" 18 #include "ash/system/tray/system_tray_notifier.h"
20 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 19 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
21 #include "base/bind.h" 20 #include "base/bind.h"
22 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
23 #include "base/threading/thread_task_runner_handle.h" 22 #include "base/threading/thread_task_runner_handle.h"
24 #include "chromeos/dbus/dbus_thread_manager.h" 23 #include "chromeos/dbus/dbus_thread_manager.h"
25 #include "chromeos/dbus/power_manager_client.h" 24 #include "chromeos/dbus/power_manager_client.h"
26 #include "grit/ash_resources.h" 25 #include "grit/ash_resources.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 214 }
216 215
217 views::View* TrayBrightness::CreateDefaultView(LoginStatus status) { 216 views::View* TrayBrightness::CreateDefaultView(LoginStatus status) {
218 CHECK(brightness_view_ == NULL); 217 CHECK(brightness_view_ == NULL);
219 brightness_view_ = new tray::BrightnessView(true, current_percent_); 218 brightness_view_ = new tray::BrightnessView(true, current_percent_);
220 return brightness_view_; 219 return brightness_view_;
221 } 220 }
222 221
223 views::View* TrayBrightness::CreateDetailedView(LoginStatus status) { 222 views::View* TrayBrightness::CreateDetailedView(LoginStatus status) {
224 CHECK(brightness_view_ == NULL); 223 CHECK(brightness_view_ == NULL);
225 Shell::GetInstance()->metrics()->RecordUserMetricsAction( 224 WmShell::Get()->RecordUserMetricsAction(
226 ash::UMA_STATUS_AREA_DETAILED_BRIGHTNESS_VIEW); 225 UMA_STATUS_AREA_DETAILED_BRIGHTNESS_VIEW);
227 brightness_view_ = new tray::BrightnessView(false, current_percent_); 226 brightness_view_ = new tray::BrightnessView(false, current_percent_);
228 return brightness_view_; 227 return brightness_view_;
229 } 228 }
230 229
231 void TrayBrightness::DestroyTrayView() { 230 void TrayBrightness::DestroyTrayView() {
232 } 231 }
233 232
234 void TrayBrightness::DestroyDefaultView() { 233 void TrayBrightness::DestroyDefaultView() {
235 if (brightness_view_ && brightness_view_->is_default_view()) 234 if (brightness_view_ && brightness_view_->is_default_view())
236 brightness_view_ = NULL; 235 brightness_view_ = NULL;
237 } 236 }
238 237
239 void TrayBrightness::DestroyDetailedView() { 238 void TrayBrightness::DestroyDetailedView() {
240 if (brightness_view_ && !brightness_view_->is_default_view()) 239 if (brightness_view_ && !brightness_view_->is_default_view())
241 brightness_view_ = NULL; 240 brightness_view_ = NULL;
242 } 241 }
243 242
244 void TrayBrightness::UpdateAfterLoginStatusChange(LoginStatus status) {} 243 void TrayBrightness::UpdateAfterLoginStatusChange(LoginStatus status) {}
245 244
246 bool TrayBrightness::ShouldHideArrow() const { 245 bool TrayBrightness::ShouldHideArrow() const {
247 return true; 246 return true;
248 } 247 }
249 248
250 bool TrayBrightness::ShouldShowShelf() const { 249 bool TrayBrightness::ShouldShowShelf() const {
251 return false; 250 return false;
252 } 251 }
253 252
254 void TrayBrightness::BrightnessChanged(int level, bool user_initiated) { 253 void TrayBrightness::BrightnessChanged(int level, bool user_initiated) {
255 Shell::GetInstance()->metrics()->RecordUserMetricsAction( 254 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_BRIGHTNESS_CHANGED);
256 ash::UMA_STATUS_AREA_BRIGHTNESS_CHANGED);
257 double percent = static_cast<double>(level); 255 double percent = static_cast<double>(level);
258 HandleBrightnessChanged(percent, user_initiated); 256 HandleBrightnessChanged(percent, user_initiated);
259 } 257 }
260 258
261 void TrayBrightness::HandleBrightnessChanged(double percent, 259 void TrayBrightness::HandleBrightnessChanged(double percent,
262 bool user_initiated) { 260 bool user_initiated) {
263 current_percent_ = percent; 261 current_percent_ = percent;
264 got_current_percent_ = true; 262 got_current_percent_ = true;
265 263
266 if (brightness_view_) 264 if (brightness_view_)
267 brightness_view_->SetBrightnessPercent(percent); 265 brightness_view_->SetBrightnessPercent(percent);
268 266
269 if (!user_initiated) 267 if (!user_initiated)
270 return; 268 return;
271 269
272 // Never show the bubble on systems that lack internal displays: if an 270 // Never show the bubble on systems that lack internal displays: if an
273 // external display's brightness is changed, it may already display the new 271 // external display's brightness is changed, it may already display the new
274 // level via an on-screen display. 272 // level via an on-screen display.
275 if (!display::Display::HasInternalDisplay()) 273 if (!display::Display::HasInternalDisplay())
276 return; 274 return;
277 275
278 if (brightness_view_) 276 if (brightness_view_)
279 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); 277 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds);
280 else 278 else
281 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); 279 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false);
282 } 280 }
283 281
284 } // namespace ash 282 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/bluetooth/tray_bluetooth.cc ('k') | ash/system/chromeos/keyboard_brightness_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698