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" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "content/browser/renderer_host/render_view_host_impl.h" | 25 #include "content/browser/renderer_host/render_view_host_impl.h" |
26 #include "content/browser/renderer_host/render_widget_host_impl.h" | 26 #include "content/browser/renderer_host/render_widget_host_impl.h" |
27 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 27 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
28 #include "content/browser/ssl/ssl_host_state.h" | 28 #include "content/browser/ssl/ssl_host_state.h" |
29 #include "content/browser/web_contents/interstitial_page_impl.h" | 29 #include "content/browser/web_contents/interstitial_page_impl.h" |
30 #include "content/browser/web_contents/navigation_controller_impl.h" | 30 #include "content/browser/web_contents/navigation_controller_impl.h" |
31 #include "content/browser/web_contents/navigation_entry_impl.h" | 31 #include "content/browser/web_contents/navigation_entry_impl.h" |
32 #include "content/browser/web_contents/web_contents_view_android.h" | 32 #include "content/browser/web_contents/web_contents_view_android.h" |
33 #include "content/common/input_messages.h" | 33 #include "content/common/input_messages.h" |
34 #include "content/common/view_messages.h" | 34 #include "content/common/view_messages.h" |
| 35 #include "content/public/browser/browser_accessibility_state.h" |
35 #include "content/public/browser/browser_context.h" | 36 #include "content/public/browser/browser_context.h" |
36 #include "content/public/browser/favicon_status.h" | 37 #include "content/public/browser/favicon_status.h" |
37 #include "content/public/browser/notification_details.h" | 38 #include "content/public/browser/notification_details.h" |
38 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
39 #include "content/public/browser/notification_source.h" | 40 #include "content/public/browser/notification_source.h" |
40 #include "content/public/browser/notification_types.h" | 41 #include "content/public/browser/notification_types.h" |
41 #include "content/public/browser/web_contents.h" | 42 #include "content/public/browser/web_contents.h" |
42 #include "content/public/common/content_client.h" | 43 #include "content/public/common/content_client.h" |
43 #include "content/public/common/content_switches.h" | 44 #include "content/public/common/content_switches.h" |
44 #include "content/public/common/page_transition_types.h" | 45 #include "content/public/common/page_transition_types.h" |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 // Send the override to the renderer. | 1566 // Send the override to the renderer. |
1566 if (reload_on_state_change) { | 1567 if (reload_on_state_change) { |
1567 // Reloading the page will send the override down as part of the | 1568 // Reloading the page will send the override down as part of the |
1568 // navigation IPC message. | 1569 // navigation IPC message. |
1569 NavigationControllerImpl& controller = | 1570 NavigationControllerImpl& controller = |
1570 static_cast<NavigationControllerImpl&>(web_contents_->GetController()); | 1571 static_cast<NavigationControllerImpl&>(web_contents_->GetController()); |
1571 controller.ReloadOriginalRequestURL(false); | 1572 controller.ReloadOriginalRequestURL(false); |
1572 } | 1573 } |
1573 } | 1574 } |
1574 | 1575 |
| 1576 void ContentViewCoreImpl::SetAccessibilityEnabled(JNIEnv* env, jobject obj, |
| 1577 bool enabled) { |
| 1578 RenderWidgetHostViewAndroid* host_view = GetRenderWidgetHostViewAndroid(); |
| 1579 if (!host_view) |
| 1580 return; |
| 1581 RenderWidgetHostImpl* host_impl = RenderWidgetHostImpl::From( |
| 1582 host_view->GetRenderWidgetHost()); |
| 1583 if (enabled) { |
| 1584 BrowserAccessibilityState::GetInstance()->EnableAccessibility(); |
| 1585 if (host_impl) |
| 1586 host_impl->SetAccessibilityMode(AccessibilityModeComplete); |
| 1587 } else { |
| 1588 BrowserAccessibilityState::GetInstance()->DisableAccessibility(); |
| 1589 if (host_impl) |
| 1590 host_impl->SetAccessibilityMode(AccessibilityModeOff); |
| 1591 } |
| 1592 } |
| 1593 |
1575 // This is called for each ContentView. | 1594 // This is called for each ContentView. |
1576 jint Init(JNIEnv* env, jobject obj, | 1595 jint Init(JNIEnv* env, jobject obj, |
1577 jboolean hardware_accelerated, | 1596 jboolean hardware_accelerated, |
1578 jint native_web_contents, | 1597 jint native_web_contents, |
1579 jint view_android, | 1598 jint view_android, |
1580 jint window_android) { | 1599 jint window_android) { |
1581 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1600 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
1582 env, obj, hardware_accelerated, | 1601 env, obj, hardware_accelerated, |
1583 reinterpret_cast<WebContents*>(native_web_contents), | 1602 reinterpret_cast<WebContents*>(native_web_contents), |
1584 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1603 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1585 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1604 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1586 return reinterpret_cast<jint>(view); | 1605 return reinterpret_cast<jint>(view); |
1587 } | 1606 } |
1588 | 1607 |
1589 bool RegisterContentViewCore(JNIEnv* env) { | 1608 bool RegisterContentViewCore(JNIEnv* env) { |
1590 return RegisterNativesImpl(env); | 1609 return RegisterNativesImpl(env); |
1591 } | 1610 } |
1592 | 1611 |
1593 } // namespace content | 1612 } // namespace content |
OLD | NEW |