Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 15741009: Native Android accessibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now build objs from C++ code using Java helpers Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 13 matching lines...) Expand all
24 #include "content/browser/renderer_host/render_view_host_impl.h" 24 #include "content/browser/renderer_host/render_view_host_impl.h"
25 #include "content/browser/renderer_host/render_widget_host_impl.h" 25 #include "content/browser/renderer_host/render_widget_host_impl.h"
26 #include "content/browser/renderer_host/render_widget_host_view_android.h" 26 #include "content/browser/renderer_host/render_widget_host_view_android.h"
27 #include "content/browser/ssl/ssl_host_state.h" 27 #include "content/browser/ssl/ssl_host_state.h"
28 #include "content/browser/web_contents/interstitial_page_impl.h" 28 #include "content/browser/web_contents/interstitial_page_impl.h"
29 #include "content/browser/web_contents/navigation_controller_impl.h" 29 #include "content/browser/web_contents/navigation_controller_impl.h"
30 #include "content/browser/web_contents/navigation_entry_impl.h" 30 #include "content/browser/web_contents/navigation_entry_impl.h"
31 #include "content/browser/web_contents/web_contents_view_android.h" 31 #include "content/browser/web_contents/web_contents_view_android.h"
32 #include "content/common/input_messages.h" 32 #include "content/common/input_messages.h"
33 #include "content/common/view_messages.h" 33 #include "content/common/view_messages.h"
34 #include "content/public/browser/browser_accessibility_state.h"
34 #include "content/public/browser/browser_context.h" 35 #include "content/public/browser/browser_context.h"
35 #include "content/public/browser/favicon_status.h" 36 #include "content/public/browser/favicon_status.h"
36 #include "content/public/browser/notification_details.h" 37 #include "content/public/browser/notification_details.h"
37 #include "content/public/browser/notification_service.h" 38 #include "content/public/browser/notification_service.h"
38 #include "content/public/browser/notification_source.h" 39 #include "content/public/browser/notification_source.h"
39 #include "content/public/browser/notification_types.h" 40 #include "content/public/browser/notification_types.h"
40 #include "content/public/browser/web_contents.h" 41 #include "content/public/browser/web_contents.h"
41 #include "content/public/common/content_client.h" 42 #include "content/public/common/content_client.h"
42 #include "content/public/common/content_switches.h" 43 #include "content/public/common/content_switches.h"
43 #include "content/public/common/page_transition_types.h" 44 #include "content/public/common/page_transition_types.h"
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 // Send the override to the renderer. 1538 // Send the override to the renderer.
1538 if (reload_on_state_change) { 1539 if (reload_on_state_change) {
1539 // Reloading the page will send the override down as part of the 1540 // Reloading the page will send the override down as part of the
1540 // navigation IPC message. 1541 // navigation IPC message.
1541 NavigationControllerImpl& controller = 1542 NavigationControllerImpl& controller =
1542 static_cast<NavigationControllerImpl&>(web_contents_->GetController()); 1543 static_cast<NavigationControllerImpl&>(web_contents_->GetController());
1543 controller.ReloadOriginalRequestURL(false); 1544 controller.ReloadOriginalRequestURL(false);
1544 } 1545 }
1545 } 1546 }
1546 1547
1548 void ContentViewCoreImpl::SetAccessibilityEnabled(JNIEnv* env, jobject obj,
1549 bool enabled) {
1550 RenderWidgetHostImpl* host_impl = RenderWidgetHostImpl::From(
1551 GetRenderWidgetHostViewAndroid()->GetRenderWidgetHost());
1552 if (enabled) {
1553 BrowserAccessibilityState::GetInstance()->EnableAccessibility();
1554 host_impl->SetAccessibilityMode(AccessibilityModeComplete);
1555 } else {
1556 BrowserAccessibilityState::GetInstance()->DisableAccessibility();
1557 host_impl->SetAccessibilityMode(AccessibilityModeOff);
1558 }
1559 }
1560
1547 // This is called for each ContentView. 1561 // This is called for each ContentView.
1548 jint Init(JNIEnv* env, jobject obj, 1562 jint Init(JNIEnv* env, jobject obj,
1549 jboolean hardware_accelerated, 1563 jboolean hardware_accelerated,
1550 jint native_web_contents, 1564 jint native_web_contents,
1551 jint view_android, 1565 jint view_android,
1552 jint window_android) { 1566 jint window_android) {
1553 ContentViewCoreImpl* view = new ContentViewCoreImpl( 1567 ContentViewCoreImpl* view = new ContentViewCoreImpl(
1554 env, obj, hardware_accelerated, 1568 env, obj, hardware_accelerated,
1555 reinterpret_cast<WebContents*>(native_web_contents), 1569 reinterpret_cast<WebContents*>(native_web_contents),
1556 reinterpret_cast<ui::ViewAndroid*>(view_android), 1570 reinterpret_cast<ui::ViewAndroid*>(view_android),
1557 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1571 reinterpret_cast<ui::WindowAndroid*>(window_android));
1558 return reinterpret_cast<jint>(view); 1572 return reinterpret_cast<jint>(view);
1559 } 1573 }
1560 1574
1561 bool RegisterContentViewCore(JNIEnv* env) { 1575 bool RegisterContentViewCore(JNIEnv* env) {
1562 return RegisterNativesImpl(env); 1576 return RegisterNativesImpl(env);
1563 } 1577 }
1564 1578
1565 } // namespace content 1579 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698