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/load_url_params.h" | 23 #include "content/browser/android/load_url_params.h" |
23 #include "content/browser/frame_host/interstitial_page_impl.h" | 24 #include "content/browser/frame_host/interstitial_page_impl.h" |
24 #include "content/browser/frame_host/navigation_controller_impl.h" | 25 #include "content/browser/frame_host/navigation_controller_impl.h" |
25 #include "content/browser/frame_host/navigation_entry_impl.h" | 26 #include "content/browser/frame_host/navigation_entry_impl.h" |
26 #include "content/browser/geolocation/geolocation_dispatcher_host.h" | 27 #include "content/browser/geolocation/geolocation_dispatcher_host.h" |
27 #include "content/browser/media/android/browser_media_player_manager.h" | 28 #include "content/browser/media/android/browser_media_player_manager.h" |
28 #include "content/browser/renderer_host/compositor_impl_android.h" | 29 #include "content/browser/renderer_host/compositor_impl_android.h" |
29 #include "content/browser/renderer_host/input/motion_event_android.h" | 30 #include "content/browser/renderer_host/input/motion_event_android.h" |
30 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" | 31 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
31 #include "content/browser/renderer_host/input/web_input_event_util.h" | 32 #include "content/browser/renderer_host/input/web_input_event_util.h" |
32 #include "content/browser/renderer_host/java/java_bound_object.h" | 33 #include "content/browser/renderer_host/java/java_bound_object.h" |
33 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" | 34 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.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/web_contents/web_contents_view_android.h" | 40 #include "content/browser/web_contents/web_contents_view_android.h" |
40 #include "content/common/input/web_input_event_traits.h" | 41 #include "content/common/input/web_input_event_traits.h" |
41 #include "content/common/input_messages.h" | 42 #include "content/common/input_messages.h" |
42 #include "content/common/view_messages.h" | 43 #include "content/common/view_messages.h" |
43 #include "content/public/browser/browser_accessibility_state.h" | |
44 #include "content/public/browser/browser_context.h" | 44 #include "content/public/browser/browser_context.h" |
45 #include "content/public/browser/favicon_status.h" | 45 #include "content/public/browser/favicon_status.h" |
46 #include "content/public/browser/notification_details.h" | 46 #include "content/public/browser/notification_details.h" |
47 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
48 #include "content/public/browser/notification_source.h" | 48 #include "content/public/browser/notification_source.h" |
49 #include "content/public/browser/notification_types.h" | 49 #include "content/public/browser/notification_types.h" |
50 #include "content/public/browser/render_frame_host.h" | 50 #include "content/public/browser/render_frame_host.h" |
51 #include "content/public/browser/web_contents.h" | 51 #include "content/public/browser/web_contents.h" |
52 #include "content/public/common/content_client.h" | 52 #include "content/public/common/content_client.h" |
53 #include "content/public/common/content_switches.h" | 53 #include "content/public/common/content_switches.h" |
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 } | 1543 } |
1544 } | 1544 } |
1545 | 1545 |
1546 void ContentViewCoreImpl::SetAccessibilityEnabled(JNIEnv* env, jobject obj, | 1546 void ContentViewCoreImpl::SetAccessibilityEnabled(JNIEnv* env, jobject obj, |
1547 bool enabled) { | 1547 bool enabled) { |
1548 SetAccessibilityEnabledInternal(enabled); | 1548 SetAccessibilityEnabledInternal(enabled); |
1549 } | 1549 } |
1550 | 1550 |
1551 void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { | 1551 void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { |
1552 accessibility_enabled_ = enabled; | 1552 accessibility_enabled_ = enabled; |
1553 RenderWidgetHostViewAndroid* host_view = GetRenderWidgetHostViewAndroid(); | 1553 BrowserAccessibilityStateImpl* accessibility_state = |
1554 if (!host_view) | 1554 BrowserAccessibilityStateImpl::GetInstance(); |
1555 return; | |
1556 RenderWidgetHostImpl* host_impl = RenderWidgetHostImpl::From( | |
1557 host_view->GetRenderWidgetHost()); | |
1558 BrowserAccessibilityState* accessibility_state = | |
1559 BrowserAccessibilityState::GetInstance(); | |
1560 if (enabled) { | 1555 if (enabled) { |
1561 // This enables accessibility globally unless it was explicitly disallowed | 1556 // This enables accessibility globally unless it was explicitly disallowed |
1562 // by a command-line flag. | 1557 // by a command-line flag. |
1563 accessibility_state->OnScreenReaderDetected(); | 1558 accessibility_state->OnScreenReaderDetected(); |
1564 // If it was actually enabled globally, enable it for this RenderWidget now. | 1559 // If it was actually enabled globally, enable it for this RenderWidget now. |
1565 if (accessibility_state->IsAccessibleBrowser() && host_impl) | 1560 if (accessibility_state->IsAccessibleBrowser() && web_contents_) |
1566 host_impl->AddAccessibilityMode(AccessibilityModeComplete); | 1561 web_contents_->AddAccessibilityMode(AccessibilityModeComplete); |
1567 } else { | 1562 } else { |
1568 accessibility_state->ResetAccessibilityMode(); | 1563 accessibility_state->ResetAccessibilityMode(); |
1569 if (host_impl) | 1564 if (web_contents_) { |
1570 host_impl->ResetAccessibilityMode(); | 1565 web_contents_->SetAccessibilityMode( |
| 1566 accessibility_state->accessibility_mode()); |
| 1567 } |
1571 } | 1568 } |
1572 } | 1569 } |
1573 | 1570 |
1574 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1571 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
1575 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1572 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
1576 if (rwhv) | 1573 if (rwhv) |
1577 rwhv->UpdateScreenInfo(GetViewAndroid()); | 1574 rwhv->UpdateScreenInfo(GetViewAndroid()); |
1578 | 1575 |
1579 // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change | 1576 // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change |
1580 // in the future. The OnResize IPC message sent from UpdateScreenInfo() will | 1577 // in the future. The OnResize IPC message sent from UpdateScreenInfo() will |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1660 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1664 retained_objects_set); | 1661 retained_objects_set); |
1665 return reinterpret_cast<intptr_t>(view); | 1662 return reinterpret_cast<intptr_t>(view); |
1666 } | 1663 } |
1667 | 1664 |
1668 bool RegisterContentViewCore(JNIEnv* env) { | 1665 bool RegisterContentViewCore(JNIEnv* env) { |
1669 return RegisterNativesImpl(env); | 1666 return RegisterNativesImpl(env); |
1670 } | 1667 } |
1671 | 1668 |
1672 } // namespace content | 1669 } // namespace content |
OLD | NEW |