summaryrefslogtreecommitdiffstats
path: root/chrome/browser/android/metrics/uma_session_stats.h
blob: 173d342bf8098efabfdee6ac3dac1f1dd6587390 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_ANDROID_METRICS_UMA_SESSION_STATS_H_
#define CHROME_BROWSER_ANDROID_METRICS_UMA_SESSION_STATS_H_

#include <jni.h>
#include <string>

#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"

class UserActionRateCounter;

// The native part of java UmaSessionStats class.
class UmaSessionStats {
 public:
  UmaSessionStats();

  void UmaResumeSession(JNIEnv* env, jobject obj);
  void UmaEndSession(JNIEnv* env, jobject obj);

  static void RegisterSyntheticFieldTrialWithNameHash(
      uint32_t trial_name_hash,
      const std::string& group_name);

  static void RegisterSyntheticFieldTrial(
      const std::string& trial_name,
      const std::string& group_name);

 private:
  ~UmaSessionStats();

  // Start of the current session, used for UMA.
  base::TimeTicks session_start_time_;
  int active_session_count_;

  DISALLOW_COPY_AND_ASSIGN(UmaSessionStats);
};

// Registers the native methods through jni
bool RegisterUmaSessionStats(JNIEnv* env);

#endif  // CHROME_BROWSER_ANDROID_METRICS_UMA_SESSION_STATS_H_