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/metrics/histogram.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "cc/layers/layer.h" | 17 #include "cc/layers/layer.h" |
18 #include "cc/layers/solid_color_layer.h" | 18 #include "cc/layers/solid_color_layer.h" |
19 #include "cc/output/begin_frame_args.h" | 19 #include "cc/output/begin_frame_args.h" |
| 20 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
20 #include "content/browser/android/gesture_event_type.h" | 21 #include "content/browser/android/gesture_event_type.h" |
21 #include "content/browser/android/interstitial_page_delegate_android.h" | 22 #include "content/browser/android/interstitial_page_delegate_android.h" |
22 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" | 23 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" |
23 #include "content/browser/android/load_url_params.h" | 24 #include "content/browser/android/load_url_params.h" |
24 #include "content/browser/android/popup_touch_handle_drawable.h" | 25 #include "content/browser/android/popup_touch_handle_drawable.h" |
25 #include "content/browser/frame_host/interstitial_page_impl.h" | 26 #include "content/browser/frame_host/interstitial_page_impl.h" |
26 #include "content/browser/frame_host/navigation_controller_impl.h" | 27 #include "content/browser/frame_host/navigation_controller_impl.h" |
27 #include "content/browser/frame_host/navigation_entry_impl.h" | 28 #include "content/browser/frame_host/navigation_entry_impl.h" |
28 #include "content/browser/geolocation/geolocation_dispatcher_host.h" | 29 #include "content/browser/geolocation/geolocation_dispatcher_host.h" |
29 #include "content/browser/media/media_web_contents_observer.h" | 30 #include "content/browser/media/media_web_contents_observer.h" |
30 #include "content/browser/renderer_host/compositor_impl_android.h" | 31 #include "content/browser/renderer_host/compositor_impl_android.h" |
31 #include "content/browser/renderer_host/input/motion_event_android.h" | 32 #include "content/browser/renderer_host/input/motion_event_android.h" |
32 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" | 33 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
33 #include "content/browser/renderer_host/input/web_input_event_util.h" | 34 #include "content/browser/renderer_host/input/web_input_event_util.h" |
34 #include "content/browser/renderer_host/render_view_host_impl.h" | 35 #include "content/browser/renderer_host/render_view_host_impl.h" |
35 #include "content/browser/renderer_host/render_widget_host_impl.h" | 36 #include "content/browser/renderer_host/render_widget_host_impl.h" |
36 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 37 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
37 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" | 38 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" |
38 #include "content/browser/ssl/ssl_host_state.h" | 39 #include "content/browser/ssl/ssl_host_state.h" |
39 #include "content/browser/transition_request_manager.h" | 40 #include "content/browser/transition_request_manager.h" |
40 #include "content/browser/web_contents/web_contents_view_android.h" | 41 #include "content/browser/web_contents/web_contents_view_android.h" |
41 #include "content/common/frame_messages.h" | 42 #include "content/common/frame_messages.h" |
42 #include "content/common/input/web_input_event_traits.h" | 43 #include "content/common/input/web_input_event_traits.h" |
43 #include "content/common/input_messages.h" | 44 #include "content/common/input_messages.h" |
44 #include "content/common/view_messages.h" | 45 #include "content/common/view_messages.h" |
45 #include "content/public/browser/browser_accessibility_state.h" | |
46 #include "content/public/browser/browser_context.h" | 46 #include "content/public/browser/browser_context.h" |
47 #include "content/public/browser/browser_thread.h" | 47 #include "content/public/browser/browser_thread.h" |
48 #include "content/public/browser/favicon_status.h" | 48 #include "content/public/browser/favicon_status.h" |
49 #include "content/public/browser/render_frame_host.h" | 49 #include "content/public/browser/render_frame_host.h" |
50 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
51 #include "content/public/common/content_client.h" | 51 #include "content/public/common/content_client.h" |
52 #include "content/public/common/content_switches.h" | 52 #include "content/public/common/content_switches.h" |
53 #include "content/public/common/menu_item.h" | 53 #include "content/public/common/menu_item.h" |
54 #include "content/public/common/page_transition_types.h" | 54 #include "content/public/common/page_transition_types.h" |
55 #include "content/public/common/user_agent.h" | 55 #include "content/public/common/user_agent.h" |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 JNIEnv* env = AttachCurrentThread(); | 1448 JNIEnv* env = AttachCurrentThread(); |
1449 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1449 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
1450 if (obj.is_null()) | 1450 if (obj.is_null()) |
1451 return true; | 1451 return true; |
1452 return Java_ContentViewCore_isFullscreenRequiredForOrientationLock(env, | 1452 return Java_ContentViewCore_isFullscreenRequiredForOrientationLock(env, |
1453 obj.obj()); | 1453 obj.obj()); |
1454 } | 1454 } |
1455 | 1455 |
1456 void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { | 1456 void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { |
1457 accessibility_enabled_ = enabled; | 1457 accessibility_enabled_ = enabled; |
1458 RenderWidgetHostViewAndroid* host_view = GetRenderWidgetHostViewAndroid(); | 1458 BrowserAccessibilityStateImpl* accessibility_state = |
1459 if (!host_view) | 1459 BrowserAccessibilityStateImpl::GetInstance(); |
1460 return; | |
1461 RenderWidgetHostImpl* host_impl = RenderWidgetHostImpl::From( | |
1462 host_view->GetRenderWidgetHost()); | |
1463 BrowserAccessibilityState* accessibility_state = | |
1464 BrowserAccessibilityState::GetInstance(); | |
1465 if (enabled) { | 1460 if (enabled) { |
1466 // This enables accessibility globally unless it was explicitly disallowed | 1461 // This enables accessibility globally unless it was explicitly disallowed |
1467 // by a command-line flag. | 1462 // by a command-line flag. |
1468 accessibility_state->OnScreenReaderDetected(); | 1463 accessibility_state->OnScreenReaderDetected(); |
1469 // If it was actually enabled globally, enable it for this RenderWidget now. | 1464 // If it was actually enabled globally, enable it for this RenderWidget now. |
1470 if (accessibility_state->IsAccessibleBrowser() && host_impl) | 1465 if (accessibility_state->IsAccessibleBrowser() && web_contents_) |
1471 host_impl->AddAccessibilityMode(AccessibilityModeComplete); | 1466 web_contents_->AddAccessibilityMode(AccessibilityModeComplete); |
1472 } else { | 1467 } else { |
1473 accessibility_state->ResetAccessibilityMode(); | 1468 accessibility_state->ResetAccessibilityMode(); |
1474 if (host_impl) | 1469 if (web_contents_) { |
1475 host_impl->ResetAccessibilityMode(); | 1470 web_contents_->SetAccessibilityMode( |
| 1471 accessibility_state->accessibility_mode()); |
| 1472 } |
1476 } | 1473 } |
1477 } | 1474 } |
1478 | 1475 |
1479 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1476 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
1480 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1477 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
1481 if (rwhv) | 1478 if (rwhv) |
1482 rwhv->UpdateScreenInfo(GetViewAndroid()); | 1479 rwhv->UpdateScreenInfo(GetViewAndroid()); |
1483 | 1480 |
1484 static_cast<WebContentsImpl*>(web_contents())-> | 1481 static_cast<WebContentsImpl*>(web_contents())-> |
1485 screen_orientation_dispatcher_host()->OnOrientationChange(); | 1482 screen_orientation_dispatcher_host()->OnOrientationChange(); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1619 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1623 retained_objects_set); | 1620 retained_objects_set); |
1624 return reinterpret_cast<intptr_t>(view); | 1621 return reinterpret_cast<intptr_t>(view); |
1625 } | 1622 } |
1626 | 1623 |
1627 bool RegisterContentViewCore(JNIEnv* env) { | 1624 bool RegisterContentViewCore(JNIEnv* env) { |
1628 return RegisterNativesImpl(env); | 1625 return RegisterNativesImpl(env); |
1629 } | 1626 } |
1630 | 1627 |
1631 } // namespace content | 1628 } // namespace content |
OLD | NEW |