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 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 } | 1541 } |
1542 } | 1542 } |
1543 | 1543 |
1544 void ContentViewCoreImpl::SetAccessibilityEnabled(JNIEnv* env, jobject obj, | 1544 void ContentViewCoreImpl::SetAccessibilityEnabled(JNIEnv* env, jobject obj, |
1545 bool enabled) { | 1545 bool enabled) { |
1546 SetAccessibilityEnabledInternal(enabled); | 1546 SetAccessibilityEnabledInternal(enabled); |
1547 } | 1547 } |
1548 | 1548 |
1549 void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { | 1549 void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { |
1550 accessibility_enabled_ = enabled; | 1550 accessibility_enabled_ = enabled; |
1551 RenderWidgetHostViewAndroid* host_view = GetRenderWidgetHostViewAndroid(); | |
1552 if (!host_view) | |
1553 return; | |
1554 RenderWidgetHostImpl* host_impl = RenderWidgetHostImpl::From( | |
1555 host_view->GetRenderWidgetHost()); | |
1556 BrowserAccessibilityState* accessibility_state = | 1551 BrowserAccessibilityState* accessibility_state = |
1557 BrowserAccessibilityState::GetInstance(); | 1552 BrowserAccessibilityState::GetInstance(); |
1558 if (enabled) { | 1553 if (enabled) { |
1559 // This enables accessibility globally unless it was explicitly disallowed | 1554 // This enables accessibility globally unless it was explicitly disallowed |
1560 // by a command-line flag. | 1555 // by a command-line flag. |
1561 accessibility_state->OnScreenReaderDetected(); | 1556 accessibility_state->OnScreenReaderDetected(); |
1562 // If it was actually enabled globally, enable it for this RenderWidget now. | 1557 // If it was actually enabled globally, enable it for this RenderWidget now. |
1563 if (accessibility_state->IsAccessibleBrowser() && host_impl) | 1558 if (accessibility_state->IsAccessibleBrowser() && web_contents_) |
1564 host_impl->AddAccessibilityMode(AccessibilityModeComplete); | 1559 web_contents_->AddAccessibilityMode(AccessibilityModeComplete); |
1565 } else { | 1560 } else { |
1566 accessibility_state->ResetAccessibilityMode(); | 1561 accessibility_state->ResetAccessibilityMode(); |
1567 if (host_impl) | 1562 if (web_contents_) { |
1568 host_impl->ResetAccessibilityMode(); | 1563 web_contents_->SetAccessibilityMode( |
| 1564 accessibility_state->accessibility_mode()); |
| 1565 } |
1569 } | 1566 } |
1570 } | 1567 } |
1571 | 1568 |
1572 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1569 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
1573 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1570 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
1574 if (rwhv) | 1571 if (rwhv) |
1575 rwhv->UpdateScreenInfo(GetViewAndroid()); | 1572 rwhv->UpdateScreenInfo(GetViewAndroid()); |
1576 | 1573 |
1577 // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change | 1574 // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change |
1578 // in the future. The OnResize IPC message sent from UpdateScreenInfo() will | 1575 // in the future. The OnResize IPC message sent from UpdateScreenInfo() will |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1658 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1662 retained_objects_set); | 1659 retained_objects_set); |
1663 return reinterpret_cast<intptr_t>(view); | 1660 return reinterpret_cast<intptr_t>(view); |
1664 } | 1661 } |
1665 | 1662 |
1666 bool RegisterContentViewCore(JNIEnv* env) { | 1663 bool RegisterContentViewCore(JNIEnv* env) { |
1667 return RegisterNativesImpl(env); | 1664 return RegisterNativesImpl(env); |
1668 } | 1665 } |
1669 | 1666 |
1670 } // namespace content | 1667 } // namespace content |
OLD | NEW |