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/media/android/browser_media_player_manager.h" | 22 #include "content/browser/media/android/browser_media_player_manager.h" |
22 #include "content/browser/renderer_host/compositor_impl_android.h" | 23 #include "content/browser/renderer_host/compositor_impl_android.h" |
23 #include "content/browser/renderer_host/input/web_input_event_builders_android.h " | 24 #include "content/browser/renderer_host/input/web_input_event_builders_android.h " |
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1605 // If it was actually enabled globally, enable it for this RenderWidget now. | 1606 // If it was actually enabled globally, enable it for this RenderWidget now. |
1606 if (accessibility_state->IsAccessibleBrowser() && host_impl) | 1607 if (accessibility_state->IsAccessibleBrowser() && host_impl) |
1607 host_impl->SetAccessibilityMode(AccessibilityModeComplete); | 1608 host_impl->SetAccessibilityMode(AccessibilityModeComplete); |
1608 } else { | 1609 } else { |
1609 accessibility_state->DisableAccessibility(); | 1610 accessibility_state->DisableAccessibility(); |
1610 if (host_impl) | 1611 if (host_impl) |
1611 host_impl->SetAccessibilityMode(AccessibilityModeOff); | 1612 host_impl->SetAccessibilityMode(AccessibilityModeOff); |
1612 } | 1613 } |
1613 } | 1614 } |
1614 | 1615 |
1616 void ContentViewCoreImpl::SendActionAfterDoubleTapUma( | |
1617 JNIEnv* env, | |
1618 jobject obj, | |
1619 int type, | |
1620 bool hasDelay) { | |
1621 // This UMA stat tracks a user's action after a double tap within | |
1622 // k seconds (where k == 5 currently). This UMA will tell us if | |
1623 // removing the tap gesture delay will lead to significantly more | |
1624 // accidental navigations after a double tap | |
Rick Byers
2013/10/31 17:53:10
nit - missing .
bokan
2013/10/31 22:31:58
Done.
| |
1625 if(hasDelay) { | |
1626 UMA_HISTOGRAM_ENUMERATION("UserInput.ActionAfterDoubleTapWithDelay", | |
1627 type, 3); | |
Rick Byers
2013/10/31 17:53:10
ugh - hard-coding this 3 is a little unfortunate,
bokan
2013/10/31 22:31:58
It's already there :). But I've gone further and j
| |
1628 } else { | |
1629 UMA_HISTOGRAM_ENUMERATION("UserInput.ActionAfterDoubleTapNoDelay", | |
1630 type, 3); | |
1631 } | |
1632 | |
1633 } | |
1634 | |
1615 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1635 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
1616 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1636 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
1617 if (rwhv) | 1637 if (rwhv) |
1618 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); | 1638 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); |
1619 | 1639 |
1620 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1640 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
1621 web_contents_->GetRenderViewHost()); | 1641 web_contents_->GetRenderViewHost()); |
1622 rvhi->SendOrientationChangeEvent(device_orientation_); | 1642 rvhi->SendOrientationChangeEvent(device_orientation_); |
1623 } | 1643 } |
1624 | 1644 |
1625 // This is called for each ContentView. | 1645 // This is called for each ContentView. |
1626 jint Init(JNIEnv* env, jobject obj, | 1646 jint Init(JNIEnv* env, jobject obj, |
1627 jboolean hardware_accelerated, | 1647 jboolean hardware_accelerated, |
1628 jint native_web_contents, | 1648 jint native_web_contents, |
1629 jint view_android, | 1649 jint view_android, |
1630 jint window_android) { | 1650 jint window_android) { |
1631 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1651 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
1632 env, obj, hardware_accelerated, | 1652 env, obj, hardware_accelerated, |
1633 reinterpret_cast<WebContents*>(native_web_contents), | 1653 reinterpret_cast<WebContents*>(native_web_contents), |
1634 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1654 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1635 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1655 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1636 return reinterpret_cast<jint>(view); | 1656 return reinterpret_cast<jint>(view); |
1637 } | 1657 } |
1638 | 1658 |
1639 bool RegisterContentViewCore(JNIEnv* env) { | 1659 bool RegisterContentViewCore(JNIEnv* env) { |
1640 return RegisterNativesImpl(env); | 1660 return RegisterNativesImpl(env); |
1641 } | 1661 } |
1642 | 1662 |
1643 } // namespace content | 1663 } // namespace content |
OLD | NEW |