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 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 // If it was actually enabled globally, enable it for this RenderWidget now. | 1621 // If it was actually enabled globally, enable it for this RenderWidget now. |
1621 if (accessibility_state->IsAccessibleBrowser() && host_impl) | 1622 if (accessibility_state->IsAccessibleBrowser() && host_impl) |
1622 host_impl->SetAccessibilityMode(AccessibilityModeComplete); | 1623 host_impl->SetAccessibilityMode(AccessibilityModeComplete); |
1623 } else { | 1624 } else { |
1624 accessibility_state->DisableAccessibility(); | 1625 accessibility_state->DisableAccessibility(); |
1625 if (host_impl) | 1626 if (host_impl) |
1626 host_impl->SetAccessibilityMode(AccessibilityModeOff); | 1627 host_impl->SetAccessibilityMode(AccessibilityModeOff); |
1627 } | 1628 } |
1628 } | 1629 } |
1629 | 1630 |
| 1631 void ContentViewCoreImpl::SendSingleTapUma(JNIEnv* env, |
| 1632 jobject obj, |
| 1633 jint type, |
| 1634 jint count) { |
| 1635 UMA_HISTOGRAM_ENUMERATION("Event.SingleTapType", type, count); |
| 1636 } |
| 1637 |
| 1638 void ContentViewCoreImpl::SendActionAfterDoubleTapUma(JNIEnv* env, |
| 1639 jobject obj, |
| 1640 jint type, |
| 1641 jboolean has_delay, |
| 1642 jint count) { |
| 1643 // This UMA stat tracks a user's action after a double tap within |
| 1644 // k seconds (where k == 5 currently). This UMA will tell us if |
| 1645 // removing the tap gesture delay will lead to significantly more |
| 1646 // accidental navigations after a double tap. |
| 1647 if (has_delay) { |
| 1648 UMA_HISTOGRAM_ENUMERATION("Event.ActionAfterDoubleTapWithDelay", type, |
| 1649 count); |
| 1650 } else { |
| 1651 UMA_HISTOGRAM_ENUMERATION("Event.ActionAfterDoubleTapNoDelay", type, |
| 1652 count); |
| 1653 } |
| 1654 } |
| 1655 |
1630 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1656 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
1631 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1657 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
1632 if (rwhv) | 1658 if (rwhv) |
1633 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); | 1659 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); |
1634 | 1660 |
1635 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1661 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
1636 web_contents_->GetRenderViewHost()); | 1662 web_contents_->GetRenderViewHost()); |
1637 rvhi->SendOrientationChangeEvent(device_orientation_); | 1663 rvhi->SendOrientationChangeEvent(device_orientation_); |
1638 } | 1664 } |
1639 | 1665 |
1640 // This is called for each ContentView. | 1666 // This is called for each ContentView. |
1641 jint Init(JNIEnv* env, jobject obj, | 1667 jint Init(JNIEnv* env, jobject obj, |
1642 jboolean hardware_accelerated, | 1668 jboolean hardware_accelerated, |
1643 jint native_web_contents, | 1669 jint native_web_contents, |
1644 jint view_android, | 1670 jint view_android, |
1645 jint window_android) { | 1671 jint window_android) { |
1646 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1672 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
1647 env, obj, hardware_accelerated, | 1673 env, obj, hardware_accelerated, |
1648 reinterpret_cast<WebContents*>(native_web_contents), | 1674 reinterpret_cast<WebContents*>(native_web_contents), |
1649 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1675 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1650 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1676 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1651 return reinterpret_cast<jint>(view); | 1677 return reinterpret_cast<jint>(view); |
1652 } | 1678 } |
1653 | 1679 |
1654 bool RegisterContentViewCore(JNIEnv* env) { | 1680 bool RegisterContentViewCore(JNIEnv* env) { |
1655 return RegisterNativesImpl(env); | 1681 return RegisterNativesImpl(env); |
1656 } | 1682 } |
1657 | 1683 |
1658 } // namespace content | 1684 } // namespace content |
OLD | NEW |