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
3// found in the LICENSE file.
4
5#include "chrome/browser/android/uma_bridge.h"
6
7#include <jni.h>
8
9#include "content/public/browser/user_metrics.h"
10#include "jni/UmaBridge_jni.h"
11
12using base::UserMetricsAction;
13using content::RecordAction;
14using content::RecordComputedAction;
15
16static void RecordMenuShow(JNIEnv*, jclass) {
17  RecordAction(UserMetricsAction("MobileMenuShow"));
18}
19
20static void RecordUsingMenu(JNIEnv*,
21                            jclass,
22                            jboolean is_by_hw_button,
23                            jboolean is_dragging) {
24  if (is_by_hw_button) {
25    if (is_dragging) {
26      NOTREACHED() << "We do not support dragging for hardware menu button.";
27    } else {
28      RecordAction(UserMetricsAction("MobileUsingMenuByHwButtonTap"));
29    }
30  } else {
31    if (is_dragging) {
32      RecordAction(UserMetricsAction("MobileUsingMenuBySwButtonDragging"));
33    } else {
34      RecordAction(UserMetricsAction("MobileUsingMenuBySwButtonTap"));
35    }
36  }
37}
38
39namespace chrome {
40namespace android {
41
42// Register native methods
43bool RegisterUmaBridge(JNIEnv* env) {
44  return RegisterNativesImpl(env);
45}
46
47}  // namespace android
48}  // namespace chrome
49