OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 using appcache::WebApplicationCacheHostImpl; | 170 using appcache::WebApplicationCacheHostImpl; |
171 using base::Time; | 171 using base::Time; |
172 using base::TimeDelta; | 172 using base::TimeDelta; |
173 using webkit_glue::AltErrorPageResourceFetcher; | 173 using webkit_glue::AltErrorPageResourceFetcher; |
174 using webkit_glue::FormData; | 174 using webkit_glue::FormData; |
175 using webkit_glue::FormField; | 175 using webkit_glue::FormField; |
176 using webkit_glue::ImageResourceFetcher; | 176 using webkit_glue::ImageResourceFetcher; |
177 using webkit_glue::PasswordForm; | 177 using webkit_glue::PasswordForm; |
178 using webkit_glue::PasswordFormDomManager; | 178 using webkit_glue::PasswordFormDomManager; |
179 using webkit_glue::SiteIsolationMetrics; | 179 using webkit_glue::SiteIsolationMetrics; |
| 180 using webkit_glue::WebAccessibility; |
180 using WebKit::WebAccessibilityCache; | 181 using WebKit::WebAccessibilityCache; |
181 using WebKit::WebAccessibilityObject; | 182 using WebKit::WebAccessibilityObject; |
182 using WebKit::WebApplicationCacheHost; | 183 using WebKit::WebApplicationCacheHost; |
183 using WebKit::WebApplicationCacheHostClient; | 184 using WebKit::WebApplicationCacheHostClient; |
184 using WebKit::WebColor; | 185 using WebKit::WebColor; |
185 using WebKit::WebColorName; | 186 using WebKit::WebColorName; |
186 using WebKit::WebConsoleMessage; | 187 using WebKit::WebConsoleMessage; |
187 using WebKit::WebContextMenuData; | 188 using WebKit::WebContextMenuData; |
188 using WebKit::WebCookieJar; | 189 using WebKit::WebCookieJar; |
189 using WebKit::WebCString; | 190 using WebKit::WebCString; |
(...skipping 4120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4310 } | 4311 } |
4311 | 4312 |
4312 void RenderView::OnGetAccessibilityTree() { | 4313 void RenderView::OnGetAccessibilityTree() { |
4313 if (accessibility_.get()) | 4314 if (accessibility_.get()) |
4314 accessibility_->clear(); | 4315 accessibility_->clear(); |
4315 accessibility_.reset(WebAccessibilityCache::create()); | 4316 accessibility_.reset(WebAccessibilityCache::create()); |
4316 accessibility_->initialize(webview()); | 4317 accessibility_->initialize(webview()); |
4317 accessibility_changes_.clear(); | 4318 accessibility_changes_.clear(); |
4318 | 4319 |
4319 WebAccessibilityObject src_tree = webview()->accessibilityObject(); | 4320 WebAccessibilityObject src_tree = webview()->accessibilityObject(); |
4320 webkit_glue::WebAccessibility dst_tree(src_tree, accessibility_.get()); | 4321 WebAccessibility dst_tree(src_tree, accessibility_.get()); |
4321 Send(new ViewHostMsg_AccessibilityTree(routing_id_, dst_tree)); | 4322 Send(new ViewHostMsg_AccessibilityTree(routing_id_, dst_tree)); |
4322 } | 4323 } |
4323 | 4324 |
4324 void RenderView::OnSetAccessibilityFocus(int acc_obj_id) { | 4325 void RenderView::OnSetAccessibilityFocus(int acc_obj_id) { |
4325 if (!accessibility_.get()) | 4326 if (!accessibility_.get()) |
4326 return; | 4327 return; |
4327 if (accessibility_->isValidId(acc_obj_id)) { | 4328 if (accessibility_->isValidId(acc_obj_id)) { |
4328 // TODO(dmazzoni) fix the cache so that id=1000 is not a magic number. | 4329 // TODO(dmazzoni) fix the cache so that id=1000 is not a magic number. |
4329 // By convention, calling SetFocus on the root of the tree (id = 1000) | 4330 // By convention, calling SetFocus on the root of the tree (id = 1000) |
4330 // should clear the current focus. Otherwise set the focus to the new | 4331 // should clear the current focus. Otherwise set the focus to the new |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5337 if (acc_obj_id >= 0) | 5338 if (acc_obj_id >= 0) |
5338 Send(new ViewHostMsg_AccessibilityFocusChange(routing_id_, acc_obj_id)); | 5339 Send(new ViewHostMsg_AccessibilityFocusChange(routing_id_, acc_obj_id)); |
5339 | 5340 |
5340 #else // defined(OS_WIN) | 5341 #else // defined(OS_WIN) |
5341 // TODO(port): accessibility not yet implemented | 5342 // TODO(port): accessibility not yet implemented |
5342 NOTIMPLEMENTED(); | 5343 NOTIMPLEMENTED(); |
5343 #endif | 5344 #endif |
5344 } | 5345 } |
5345 | 5346 |
5346 void RenderView::didChangeAccessibilityObjectState( | 5347 void RenderView::didChangeAccessibilityObjectState( |
5347 const WebKit::WebAccessibilityObject& acc_obj) { | 5348 const WebAccessibilityObject& acc_obj) { |
5348 #if defined(OS_WIN) | |
5349 // TODO(dglazkov): Current logic implies that a state change can only be made | |
5350 // after at least one call to RenderView::OnGetAccessibilityInfo, which is | |
5351 // where accessibility is initialized. We should determine whether that's | |
5352 // right. | |
5353 if (!accessibility_.get()) | 5349 if (!accessibility_.get()) |
5354 return; | 5350 return; |
5355 | 5351 |
5356 // Retrieve the accessibility object id of the AccessibilityObject. | 5352 Send(new ViewHostMsg_AccessibilityObjectStateChange( |
5357 int acc_obj_id = accessibility_->addOrGetId(acc_obj); | 5353 routing_id_, WebAccessibility(acc_obj, accessibility_.get()))); |
5358 | |
5359 // If id is valid, alert the browser side that an accessibility object state | |
5360 // change occurred. | |
5361 if (acc_obj_id >= 0) | |
5362 Send(new ViewHostMsg_AccessibilityObjectStateChange(routing_id_, | |
5363 acc_obj_id)); | |
5364 | |
5365 #else // defined(OS_WIN) | |
5366 // TODO(port): accessibility not yet implemented | |
5367 NOTIMPLEMENTED(); | |
5368 #endif | |
5369 } | 5354 } |
5370 | 5355 |
5371 void RenderView::didChangeAccessibilityObjectChildren( | 5356 void RenderView::didChangeAccessibilityObjectChildren( |
5372 const WebKit::WebAccessibilityObject& acc_obj) { | 5357 const WebAccessibilityObject& acc_obj) { |
5373 if (!accessibility_.get()) | 5358 if (!accessibility_.get()) |
5374 return; | 5359 return; |
5375 | 5360 |
5376 if (accessibility_changes_.empty()) { | 5361 if (accessibility_changes_.empty()) { |
5377 Send(new ViewHostMsg_AccessibilityObjectChildrenChange( | 5362 Send(new ViewHostMsg_AccessibilityObjectChildrenChange( |
5378 routing_id_, | 5363 routing_id_, std::vector<WebAccessibility>())); |
5379 std::vector<webkit_glue::WebAccessibility>())); | |
5380 } | 5364 } |
5381 | 5365 |
5382 accessibility_changes_.push_back( | 5366 accessibility_changes_.push_back( |
5383 webkit_glue::WebAccessibility(acc_obj, accessibility_.get())); | 5367 WebAccessibility(acc_obj, accessibility_.get())); |
5384 } | 5368 } |
5385 | 5369 |
5386 void RenderView::Print(WebFrame* frame, bool script_initiated) { | 5370 void RenderView::Print(WebFrame* frame, bool script_initiated) { |
5387 DCHECK(frame); | 5371 DCHECK(frame); |
5388 if (print_helper_.get() == NULL) { | 5372 if (print_helper_.get() == NULL) { |
5389 print_helper_.reset(new PrintWebViewHelper(this)); | 5373 print_helper_.reset(new PrintWebViewHelper(this)); |
5390 } | 5374 } |
5391 print_helper_->Print(frame, script_initiated); | 5375 print_helper_->Print(frame, script_initiated); |
5392 } | 5376 } |
5393 | 5377 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5673 PendingOpenFileSystem* request = pending_file_system_requests_.Lookup( | 5657 PendingOpenFileSystem* request = pending_file_system_requests_.Lookup( |
5674 request_id); | 5658 request_id); |
5675 DCHECK(request); | 5659 DCHECK(request); |
5676 if (accepted) | 5660 if (accepted) |
5677 request->callbacks->didOpenFileSystem(name, root_path); | 5661 request->callbacks->didOpenFileSystem(name, root_path); |
5678 else | 5662 else |
5679 request->callbacks->didFail(WebKit::WebFileErrorSecurity); | 5663 request->callbacks->didFail(WebKit::WebFileErrorSecurity); |
5680 request->callbacks = NULL; | 5664 request->callbacks = NULL; |
5681 pending_file_system_requests_.Remove(request_id); | 5665 pending_file_system_requests_.Remove(request_id); |
5682 } | 5666 } |
OLD | NEW |