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

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

Issue 9939011: Add an accessibility mode for editable text fields only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 10 matching lines...) Expand all
21 #include "content/browser/renderer_host/backing_store.h" 21 #include "content/browser/renderer_host/backing_store.h"
22 #include "content/browser/renderer_host/backing_store_manager.h" 22 #include "content/browser/renderer_host/backing_store_manager.h"
23 #include "content/browser/renderer_host/render_process_host_impl.h" 23 #include "content/browser/renderer_host/render_process_host_impl.h"
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_helper.h" 25 #include "content/browser/renderer_host/render_widget_helper.h"
26 #include "content/browser/renderer_host/tap_suppression_controller.h" 26 #include "content/browser/renderer_host/tap_suppression_controller.h"
27 #include "content/common/accessibility_messages.h" 27 #include "content/common/accessibility_messages.h"
28 #include "content/common/gpu/gpu_messages.h" 28 #include "content/common/gpu/gpu_messages.h"
29 #include "content/common/view_messages.h" 29 #include "content/common/view_messages.h"
30 #include "content/port/browser/render_widget_host_view_port.h" 30 #include "content/port/browser/render_widget_host_view_port.h"
31 #include "content/public/browser/browser_accessibility_state.h"
32 #include "content/public/browser/native_web_keyboard_event.h" 31 #include "content/public/browser/native_web_keyboard_event.h"
33 #include "content/public/browser/notification_service.h" 32 #include "content/public/browser/notification_service.h"
34 #include "content/public/browser/notification_types.h" 33 #include "content/public/browser/notification_types.h"
35 #include "content/public/browser/user_metrics.h" 34 #include "content/public/browser/user_metrics.h"
36 #include "content/public/common/content_switches.h" 35 #include "content/public/common/content_switches.h"
37 #include "content/public/common/result_codes.h" 36 #include "content/public/common/result_codes.h"
38 #include "skia/ext/image_operations.h" 37 #include "skia/ext/image_operations.h"
39 #include "skia/ext/platform_canvas.h" 38 #include "skia/ext/platform_canvas.h"
40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h" 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h"
41 #include "ui/base/keycodes/keyboard_codes.h" 40 #include "ui/base/keycodes/keyboard_codes.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 /////////////////////////////////////////////////////////////////////////////// 98 ///////////////////////////////////////////////////////////////////////////////
100 // RenderWidgetHostImpl 99 // RenderWidgetHostImpl
101 100
102 RenderWidgetHostImpl::RenderWidgetHostImpl(RenderProcessHost* process, 101 RenderWidgetHostImpl::RenderWidgetHostImpl(RenderProcessHost* process,
103 int routing_id) 102 int routing_id)
104 : view_(NULL), 103 : view_(NULL),
105 renderer_initialized_(false), 104 renderer_initialized_(false),
106 hung_renderer_delay_ms_(kHungRendererDelayMs), 105 hung_renderer_delay_ms_(kHungRendererDelayMs),
107 process_(process), 106 process_(process),
108 routing_id_(routing_id), 107 routing_id_(routing_id),
109 renderer_accessible_(false),
110 surface_id_(0), 108 surface_id_(0),
111 is_loading_(false), 109 is_loading_(false),
112 is_hidden_(false), 110 is_hidden_(false),
113 is_fullscreen_(false), 111 is_fullscreen_(false),
114 is_accelerated_compositing_active_(false), 112 is_accelerated_compositing_active_(false),
115 repaint_ack_pending_(false), 113 repaint_ack_pending_(false),
116 resize_ack_pending_(false), 114 resize_ack_pending_(false),
117 should_auto_resize_(false), 115 should_auto_resize_(false),
118 mouse_move_pending_(false), 116 mouse_move_pending_(false),
119 mouse_wheel_pending_(false), 117 mouse_wheel_pending_(false),
(...skipping 27 matching lines...) Expand all
147 surface_id_ = GpuSurfaceTracker::Get()->LookupSurfaceForRenderer( 145 surface_id_ = GpuSurfaceTracker::Get()->LookupSurfaceForRenderer(
148 process_->GetID(), 146 process_->GetID(),
149 routing_id_); 147 routing_id_);
150 DCHECK(surface_id_); 148 DCHECK(surface_id_);
151 } 149 }
152 150
153 process_->Attach(this, routing_id_); 151 process_->Attach(this, routing_id_);
154 // Because the widget initializes as is_hidden_ == false, 152 // Because the widget initializes as is_hidden_ == false,
155 // tell the process host that we're alive. 153 // tell the process host that we're alive.
156 process_->WidgetRestored(); 154 process_->WidgetRestored();
157
158 // Enable accessibility if it was manually specified or if it was
159 // auto-detected.
160 if (CommandLine::ForCurrentProcess()->HasSwitch(
161 switches::kForceRendererAccessibility)) {
162 BrowserAccessibilityState::GetInstance()->OnAccessibilityEnabledManually();
163 EnableRendererAccessibility();
164 } else if (BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser()) {
165 EnableRendererAccessibility();
166 }
167 } 155 }
168 156
169 RenderWidgetHostImpl::~RenderWidgetHostImpl() { 157 RenderWidgetHostImpl::~RenderWidgetHostImpl() {
170 SetView(NULL); 158 SetView(NULL);
171 159
172 // Clear our current or cached backing store if either remains. 160 // Clear our current or cached backing store if either remains.
173 BackingStoreManager::RemoveBackingStore(this); 161 BackingStoreManager::RemoveBackingStore(this);
174 162
175 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); 163 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_);
176 surface_id_ = 0; 164 surface_id_ = 0;
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 BackingStore* backing_store = BackingStoreManager::Lookup(this); 1466 BackingStore* backing_store = BackingStoreManager::Lookup(this);
1479 if (!backing_store || (backing_store->size() != view_size)) 1467 if (!backing_store || (backing_store->size() != view_size))
1480 return; 1468 return;
1481 backing_store->ScrollBackingStore(dx, dy, clip_rect, view_size); 1469 backing_store->ScrollBackingStore(dx, dy, clip_rect, view_size);
1482 } 1470 }
1483 1471
1484 void RenderWidgetHostImpl::Replace(const string16& word) { 1472 void RenderWidgetHostImpl::Replace(const string16& word) {
1485 Send(new ViewMsg_Replace(routing_id_, word)); 1473 Send(new ViewMsg_Replace(routing_id_, word));
1486 } 1474 }
1487 1475
1488 void RenderWidgetHostImpl::EnableRendererAccessibility() { 1476 void RenderWidgetHostImpl::SetAccessibilityMode(AccessibilityMode mode) {
1489 if (renderer_accessible_) 1477 Send(new AccessibilityMsg_SetMode(routing_id_, mode));
1490 return;
1491
1492 if (CommandLine::ForCurrentProcess()->HasSwitch(
1493 switches::kDisableRendererAccessibility)) {
1494 return;
1495 }
1496
1497 renderer_accessible_ = true;
1498
1499 if (process_->HasConnection()) {
1500 // Renderer accessibility wasn't enabled on process launch. Enable it now.
1501 Send(new AccessibilityMsg_Enable(GetRoutingID()));
1502 }
1503 } 1478 }
1504 1479
1505 void RenderWidgetHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { 1480 void RenderWidgetHostImpl::SetIgnoreInputEvents(bool ignore_input_events) {
1506 ignore_input_events_ = ignore_input_events; 1481 ignore_input_events_ = ignore_input_events;
1507 } 1482 }
1508 1483
1509 void RenderWidgetHostImpl::ProcessKeyboardEventAck(int type, bool processed) { 1484 void RenderWidgetHostImpl::ProcessKeyboardEventAck(int type, bool processed) {
1510 if (key_queue_.empty()) { 1485 if (key_queue_.empty()) {
1511 LOG(ERROR) << "Got a KeyEvent back from the renderer but we " 1486 LOG(ERROR) << "Got a KeyEvent back from the renderer but we "
1512 << "don't seem to have sent it to the renderer!"; 1487 << "don't seem to have sent it to the renderer!";
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 // indicate that no callback is in progress (i.e. without this line 1684 // indicate that no callback is in progress (i.e. without this line
1710 // DelayedAutoResized will not get called again). 1685 // DelayedAutoResized will not get called again).
1711 new_auto_size_.SetSize(0, 0); 1686 new_auto_size_.SetSize(0, 0);
1712 if (!should_auto_resize_) 1687 if (!should_auto_resize_)
1713 return; 1688 return;
1714 1689
1715 OnRenderAutoResized(new_size); 1690 OnRenderAutoResized(new_size);
1716 } 1691 }
1717 1692
1718 } // namespace content 1693 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698