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

Side by Side Diff: content/browser/battery_status/battery_status_manager_android.cc

Issue 316863004: Battery Status API: add UMA logging for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed enum value type and name Created 6 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/battery_status/battery_status_manager.h" 5 #include "content/browser/battery_status/battery_status_manager.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/metrics/histogram.h"
8 #include "jni/BatteryStatusManager_jni.h" 9 #include "jni/BatteryStatusManager_jni.h"
9 10
10 using base::android::AttachCurrentThread; 11 using base::android::AttachCurrentThread;
11 12
12 namespace content { 13 namespace content {
13 14
14 BatteryStatusManager::BatteryStatusManager( 15 BatteryStatusManager::BatteryStatusManager(
15 const BatteryStatusService::BatteryUpdateCallback& callback) 16 const BatteryStatusService::BatteryUpdateCallback& callback)
16 : callback_(callback) { 17 : callback_(callback) {
17 j_manager_.Reset( 18 j_manager_.Reset(
(...skipping 16 matching lines...) Expand all
34 jdouble level) { 35 jdouble level) {
35 blink::WebBatteryStatus status; 36 blink::WebBatteryStatus status;
36 status.charging = charging; 37 status.charging = charging;
37 status.chargingTime = charging_time; 38 status.chargingTime = charging_time;
38 status.dischargingTime = discharging_time; 39 status.dischargingTime = discharging_time;
39 status.level = level; 40 status.level = level;
40 callback_.Run(status); 41 callback_.Run(status);
41 } 42 }
42 43
43 bool BatteryStatusManager::StartListeningBatteryChange() { 44 bool BatteryStatusManager::StartListeningBatteryChange() {
44 return Java_BatteryStatusManager_start( 45 bool result = Java_BatteryStatusManager_start(AttachCurrentThread(),
45 AttachCurrentThread(), j_manager_.obj(), 46 j_manager_.obj(), reinterpret_cast<intptr_t>(this));
46 reinterpret_cast<intptr_t>(this)); 47 UMA_HISTOGRAM_BOOLEAN("BatteryStatus.StartAndroid", result);
48 return result;
47 } 49 }
48 50
49 void BatteryStatusManager::StopListeningBatteryChange() { 51 void BatteryStatusManager::StopListeningBatteryChange() {
50 Java_BatteryStatusManager_stop( 52 Java_BatteryStatusManager_stop(
51 AttachCurrentThread(), j_manager_.obj()); 53 AttachCurrentThread(), j_manager_.obj());
52 } 54 }
53 55
54 } // namespace content 56 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698