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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_win.cc

Issue 9939011: Add an accessibility mode for editable text fields only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments and rebased. Created 8 years, 8 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 | Annotate | Revision Log
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/renderer_host/render_widget_host_view_win.h" 5 #include "content/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <peninputpanel_i.c> 8 #include <peninputpanel_i.c>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 gfx::NativeView RenderWidgetHostViewWin::GetNativeView() const { 457 gfx::NativeView RenderWidgetHostViewWin::GetNativeView() const {
458 return m_hWnd; 458 return m_hWnd;
459 } 459 }
460 460
461 gfx::NativeViewId RenderWidgetHostViewWin::GetNativeViewId() const { 461 gfx::NativeViewId RenderWidgetHostViewWin::GetNativeViewId() const {
462 return reinterpret_cast<gfx::NativeViewId>(m_hWnd); 462 return reinterpret_cast<gfx::NativeViewId>(m_hWnd);
463 } 463 }
464 464
465 gfx::NativeViewAccessible 465 gfx::NativeViewAccessible
466 RenderWidgetHostViewWin::GetNativeViewAccessible() { 466 RenderWidgetHostViewWin::GetNativeViewAccessible() {
467 if (render_widget_host_ && !render_widget_host_->renderer_accessible()) { 467 if (render_widget_host_ &&
468 !BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser()) {
468 // Attempt to detect screen readers by sending an event with our custom id. 469 // Attempt to detect screen readers by sending an event with our custom id.
469 NotifyWinEvent(EVENT_SYSTEM_ALERT, m_hWnd, kIdCustom, CHILDID_SELF); 470 NotifyWinEvent(EVENT_SYSTEM_ALERT, m_hWnd, kIdCustom, CHILDID_SELF);
470 } 471 }
471 472
472 if (!GetBrowserAccessibilityManager()) { 473 if (!GetBrowserAccessibilityManager()) {
473 // Return busy document tree while renderer accessibility tree loads. 474 // Return busy document tree while renderer accessibility tree loads.
474 WebAccessibility::State busy_state = 475 WebAccessibility::State busy_state =
475 static_cast<WebAccessibility::State>(1 << WebAccessibility::STATE_BUSY); 476 static_cast<WebAccessibility::State>(1 << WebAccessibility::STATE_BUSY);
476 SetBrowserAccessibilityManager( 477 SetBrowserAccessibilityManager(
477 BrowserAccessibilityManager::CreateEmptyDocument( 478 BrowserAccessibilityManager::CreateEmptyDocument(
(...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after
2273 render_widget_host_->AccessibilitySetTextSelection( 2274 render_widget_host_->AccessibilitySetTextSelection(
2274 acc_obj_id, start_offset, end_offset); 2275 acc_obj_id, start_offset, end_offset);
2275 } 2276 }
2276 2277
2277 LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam, 2278 LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam,
2278 LPARAM lparam, BOOL& handled) { 2279 LPARAM lparam, BOOL& handled) {
2279 if (kIdCustom == lparam) { 2280 if (kIdCustom == lparam) {
2280 // An MSAA client requestes our custom id. Assume that we have detected an 2281 // An MSAA client requestes our custom id. Assume that we have detected an
2281 // active windows screen reader. 2282 // active windows screen reader.
2282 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); 2283 BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected();
2283 render_widget_host_->EnableRendererAccessibility(); 2284 if (BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser())
2285 render_widget_host_->SetAccessibilityMode(AccessibilityModeComplete);
2284 2286
2285 // Return with failure. 2287 // Return with failure.
2286 return static_cast<LRESULT>(0L); 2288 return static_cast<LRESULT>(0L);
2287 } 2289 }
2288 2290
2289 if (lparam != OBJID_CLIENT) { 2291 if (lparam != OBJID_CLIENT) {
2290 handled = false; 2292 handled = false;
2291 return static_cast<LRESULT>(0L); 2293 return static_cast<LRESULT>(0L);
2292 } 2294 }
2293 2295
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 void RenderWidgetHostViewWin::ResetPointerDownContext() { 2676 void RenderWidgetHostViewWin::ResetPointerDownContext() {
2675 // If the default focus on the page is on an edit field and we did not 2677 // If the default focus on the page is on an edit field and we did not
2676 // receive a focus change in the context of a pointer down message, it means 2678 // receive a focus change in the context of a pointer down message, it means
2677 // that the pointer down message occurred on the edit field and we should 2679 // that the pointer down message occurred on the edit field and we should
2678 // display the on screen keyboard 2680 // display the on screen keyboard
2679 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) 2681 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_)
2680 DisplayOnScreenKeyboardIfNeeded(); 2682 DisplayOnScreenKeyboardIfNeeded();
2681 received_focus_change_after_pointer_down_ = false; 2683 received_focus_change_after_pointer_down_ = false;
2682 pointer_down_context_ = false; 2684 pointer_down_context_ = false;
2683 } 2685 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698