OLD | NEW |
---|---|
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 Loading... | |
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, | |
1626 jobject obj, | |
1627 int type, | |
1628 int count) { | |
1629 UMA_HISTOGRAM_ENUMERATION("UserInput.SingleTapType", | |
Rick Byers
2013/11/01 19:27:03
Nit: rather than create a new UserInput top level,
bokan
2013/11/01 19:54:02
Changed these to Event - Touchscreen doesn't seem
Rick Byers
2013/11/01 20:03:27
Ah, this is another one that's still stuck in the
| |
1630 type, count); | |
1631 } | |
1632 | |
1633 void ContentViewCoreImpl::SendActionAfterDoubleTapUma( | |
1634 JNIEnv* env, | |
1635 jobject obj, | |
1636 int type, | |
1637 bool hasDelay, | |
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) { | |
1644 UMA_HISTOGRAM_ENUMERATION("UserInput.ActionAfterDoubleTapWithDelay", | |
1645 type, count); | |
1646 } else { | |
1647 UMA_HISTOGRAM_ENUMERATION("UserInput.ActionAfterDoubleTapNoDelay", | |
1648 type, count); | |
1649 } | |
1650 | |
1651 } | |
1652 | |
1623 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1653 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
1624 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1654 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
1625 if (rwhv) | 1655 if (rwhv) |
1626 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); | 1656 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); |
1627 | 1657 |
1628 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1658 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
1629 web_contents_->GetRenderViewHost()); | 1659 web_contents_->GetRenderViewHost()); |
1630 rvhi->SendOrientationChangeEvent(device_orientation_); | 1660 rvhi->SendOrientationChangeEvent(device_orientation_); |
1631 } | 1661 } |
1632 | 1662 |
1633 // This is called for each ContentView. | 1663 // This is called for each ContentView. |
1634 jint Init(JNIEnv* env, jobject obj, | 1664 jint Init(JNIEnv* env, jobject obj, |
1635 jboolean hardware_accelerated, | 1665 jboolean hardware_accelerated, |
1636 jint native_web_contents, | 1666 jint native_web_contents, |
1637 jint view_android, | 1667 jint view_android, |
1638 jint window_android) { | 1668 jint window_android) { |
1639 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1669 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
1640 env, obj, hardware_accelerated, | 1670 env, obj, hardware_accelerated, |
1641 reinterpret_cast<WebContents*>(native_web_contents), | 1671 reinterpret_cast<WebContents*>(native_web_contents), |
1642 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1672 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1643 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1673 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1644 return reinterpret_cast<jint>(view); | 1674 return reinterpret_cast<jint>(view); |
1645 } | 1675 } |
1646 | 1676 |
1647 bool RegisterContentViewCore(JNIEnv* env) { | 1677 bool RegisterContentViewCore(JNIEnv* env) { |
1648 return RegisterNativesImpl(env); | 1678 return RegisterNativesImpl(env); |
1649 } | 1679 } |
1650 | 1680 |
1651 } // namespace content | 1681 } // namespace content |
OLD | NEW |