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::SendDelayedTapUma( | |
1625 JNIEnv* env, | |
1626 jobject obj) { | |
1627 content::RecordAction(content::UserMetricsAction("DelayedGestureTap")); | |
Rick Byers
2013/11/01 14:45:09
This is OK (I think it gives us the main measure w
bokan
2013/11/01 18:52:44
Yup, makes sense and shouldn't be hard.
| |
1628 } | |
1629 | |
1630 void ContentViewCoreImpl::SendActionAfterDoubleTapUma( | |
1631 JNIEnv* env, | |
1632 jobject obj, | |
1633 int type, | |
1634 bool hasDelay, | |
1635 int count) { | |
1636 // This UMA stat tracks a user's action after a double tap within | |
1637 // k seconds (where k == 5 currently). This UMA will tell us if | |
1638 // removing the tap gesture delay will lead to significantly more | |
1639 // accidental navigations after a double tap. | |
1640 if(hasDelay) { | |
1641 UMA_HISTOGRAM_ENUMERATION("UserInput.ActionAfterDoubleTapWithDelay", | |
1642 type, count); | |
1643 } else { | |
1644 UMA_HISTOGRAM_ENUMERATION("UserInput.ActionAfterDoubleTapNoDelay", | |
1645 type, count); | |
1646 } | |
1647 | |
1648 } | |
1649 | |
1623 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1650 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
1624 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1651 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
1625 if (rwhv) | 1652 if (rwhv) |
1626 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); | 1653 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); |
1627 | 1654 |
1628 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1655 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
1629 web_contents_->GetRenderViewHost()); | 1656 web_contents_->GetRenderViewHost()); |
1630 rvhi->SendOrientationChangeEvent(device_orientation_); | 1657 rvhi->SendOrientationChangeEvent(device_orientation_); |
1631 } | 1658 } |
1632 | 1659 |
1633 // This is called for each ContentView. | 1660 // This is called for each ContentView. |
1634 jint Init(JNIEnv* env, jobject obj, | 1661 jint Init(JNIEnv* env, jobject obj, |
1635 jboolean hardware_accelerated, | 1662 jboolean hardware_accelerated, |
1636 jint native_web_contents, | 1663 jint native_web_contents, |
1637 jint view_android, | 1664 jint view_android, |
1638 jint window_android) { | 1665 jint window_android) { |
1639 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1666 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
1640 env, obj, hardware_accelerated, | 1667 env, obj, hardware_accelerated, |
1641 reinterpret_cast<WebContents*>(native_web_contents), | 1668 reinterpret_cast<WebContents*>(native_web_contents), |
1642 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1669 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1643 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1670 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1644 return reinterpret_cast<jint>(view); | 1671 return reinterpret_cast<jint>(view); |
1645 } | 1672 } |
1646 | 1673 |
1647 bool RegisterContentViewCore(JNIEnv* env) { | 1674 bool RegisterContentViewCore(JNIEnv* env) { |
1648 return RegisterNativesImpl(env); | 1675 return RegisterNativesImpl(env); |
1649 } | 1676 } |
1650 | 1677 |
1651 } // namespace content | 1678 } // namespace content |
OLD | NEW |