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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 53283003: Added UMA stat for tracking accidental navigations on double tap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/metrics/histogram.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "base/values.h" 16 #include "base/values.h"
16 #include "cc/layers/layer.h" 17 #include "cc/layers/layer.h"
17 #include "cc/output/begin_frame_args.h" 18 #include "cc/output/begin_frame_args.h"
18 #include "content/browser/android/interstitial_page_delegate_android.h" 19 #include "content/browser/android/interstitial_page_delegate_android.h"
19 #include "content/browser/android/load_url_params.h" 20 #include "content/browser/android/load_url_params.h"
20 #include "content/browser/android/touch_point.h" 21 #include "content/browser/android/touch_point.h"
21 #include "content/browser/frame_host/interstitial_page_impl.h" 22 #include "content/browser/frame_host/interstitial_page_impl.h"
22 #include "content/browser/frame_host/navigation_controller_impl.h" 23 #include "content/browser/frame_host/navigation_controller_impl.h"
23 #include "content/browser/frame_host/navigation_entry_impl.h" 24 #include "content/browser/frame_host/navigation_entry_impl.h"
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 // If it was actually enabled globally, enable it for this RenderWidget now. 1614 // If it was actually enabled globally, enable it for this RenderWidget now.
1614 if (accessibility_state->IsAccessibleBrowser() && host_impl) 1615 if (accessibility_state->IsAccessibleBrowser() && host_impl)
1615 host_impl->SetAccessibilityMode(AccessibilityModeComplete); 1616 host_impl->SetAccessibilityMode(AccessibilityModeComplete);
1616 } else { 1617 } else {
1617 accessibility_state->DisableAccessibility(); 1618 accessibility_state->DisableAccessibility();
1618 if (host_impl) 1619 if (host_impl)
1619 host_impl->SetAccessibilityMode(AccessibilityModeOff); 1620 host_impl->SetAccessibilityMode(AccessibilityModeOff);
1620 } 1621 }
1621 } 1622 }
1622 1623
1624 void ContentViewCoreImpl::SendSingleTapUma(
1625 JNIEnv* env,
Alexei Svitkine (slow) 2013/11/02 00:12:39 Nit: move this to the line above and align the oth
Alexei Svitkine (slow) 2013/11/02 00:15:05 On 2013/11/02 00:12:39, Alexei Svitkine wrote: > N
bokan 2013/11/04 20:01:08 Done.
1626 jobject obj,
1627 int type,
1628 int count) {
1629 UMA_HISTOGRAM_ENUMERATION("Event.SingleTapType",
1630 type, count);
Alexei Svitkine (slow) 2013/11/02 00:12:39 Nit: These can fit on the previous line.
Alexei Svitkine (slow) 2013/11/02 00:15:05 On 2013/11/02 00:12:39, Alexei Svitkine wrote: > N
bokan 2013/11/04 20:01:08 Done.
1631 }
1632
1633 void ContentViewCoreImpl::SendActionAfterDoubleTapUma(
1634 JNIEnv* env,
1635 jobject obj,
1636 int type,
1637 bool hasDelay,
Alexei Svitkine (slow) 2013/11/02 00:12:39 Nit: has_delay
Alexei Svitkine (slow) 2013/11/02 00:15:05 On 2013/11/02 00:12:39, Alexei Svitkine wrote: > N
bokan 2013/11/04 20:01:08 Done.
1638 int count) {
1639 // This UMA stat tracks a user's action after a double tap within
1640 // k seconds (where k == 5 currently). This UMA will tell us if
1641 // removing the tap gesture delay will lead to significantly more
1642 // accidental navigations after a double tap.
1643 if(hasDelay) {
Alexei Svitkine (slow) 2013/11/02 00:12:39 Nit: Space after if
Alexei Svitkine (slow) 2013/11/02 00:15:05 On 2013/11/02 00:12:39, Alexei Svitkine wrote: > N
bokan 2013/11/04 20:01:08 Done.
1644 UMA_HISTOGRAM_ENUMERATION("Event.ActionAfterDoubleTapWithDelay",
1645 type, count);
Alexei Svitkine (slow) 2013/11/02 00:12:39 Nit: Can these fit on the previous line? If not, t
Alexei Svitkine (slow) 2013/11/02 00:15:05 On 2013/11/02 00:12:39, Alexei Svitkine wrote: > N
bokan 2013/11/04 20:01:08 Done.
1646 } else {
1647 UMA_HISTOGRAM_ENUMERATION("Event.ActionAfterDoubleTapNoDelay",
1648 type, count);
1649 }
1650 }
1651
1623 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { 1652 void ContentViewCoreImpl::SendOrientationChangeEventInternal() {
1624 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 1653 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
1625 if (rwhv) 1654 if (rwhv)
1626 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); 1655 rwhv->UpdateScreenInfo(rwhv->GetNativeView());
1627 1656
1628 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( 1657 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
1629 web_contents_->GetRenderViewHost()); 1658 web_contents_->GetRenderViewHost());
1630 rvhi->SendOrientationChangeEvent(device_orientation_); 1659 rvhi->SendOrientationChangeEvent(device_orientation_);
1631 } 1660 }
1632 1661
1633 // This is called for each ContentView. 1662 // This is called for each ContentView.
1634 jint Init(JNIEnv* env, jobject obj, 1663 jint Init(JNIEnv* env, jobject obj,
1635 jboolean hardware_accelerated, 1664 jboolean hardware_accelerated,
1636 jint native_web_contents, 1665 jint native_web_contents,
1637 jint view_android, 1666 jint view_android,
1638 jint window_android) { 1667 jint window_android) {
1639 ContentViewCoreImpl* view = new ContentViewCoreImpl( 1668 ContentViewCoreImpl* view = new ContentViewCoreImpl(
1640 env, obj, hardware_accelerated, 1669 env, obj, hardware_accelerated,
1641 reinterpret_cast<WebContents*>(native_web_contents), 1670 reinterpret_cast<WebContents*>(native_web_contents),
1642 reinterpret_cast<ui::ViewAndroid*>(view_android), 1671 reinterpret_cast<ui::ViewAndroid*>(view_android),
1643 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1672 reinterpret_cast<ui::WindowAndroid*>(window_android));
1644 return reinterpret_cast<jint>(view); 1673 return reinterpret_cast<jint>(view);
1645 } 1674 }
1646 1675
1647 bool RegisterContentViewCore(JNIEnv* env) { 1676 bool RegisterContentViewCore(JNIEnv* env) {
1648 return RegisterNativesImpl(env); 1677 return RegisterNativesImpl(env);
1649 } 1678 }
1650 1679
1651 } // namespace content 1680 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698