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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 1989009: Revert 46842 - Reimplement accessibility of web content by caching the entire... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 7 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
« no previous file with comments | « chrome/renderer/render_view.h ('k') | third_party/iaccessible2/ia2_api_all.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include "gfx/native_widget_types.h" 68 #include "gfx/native_widget_types.h"
69 #include "grit/generated_resources.h" 69 #include "grit/generated_resources.h"
70 #include "grit/renderer_resources.h" 70 #include "grit/renderer_resources.h"
71 #include "net/base/data_url.h" 71 #include "net/base/data_url.h"
72 #include "net/base/escape.h" 72 #include "net/base/escape.h"
73 #include "net/base/net_errors.h" 73 #include "net/base/net_errors.h"
74 #include "skia/ext/bitmap_platform_device.h" 74 #include "skia/ext/bitmap_platform_device.h"
75 #include "skia/ext/image_operations.h" 75 #include "skia/ext/image_operations.h"
76 #include "third_party/cld/encodings/compact_lang_det/win/cld_unicodetext.h" 76 #include "third_party/cld/encodings/compact_lang_det/win/cld_unicodetext.h"
77 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h" 77 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h"
78 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h"
78 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" 79 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h"
79 #include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h" 80 #include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h"
80 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h" 81 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h"
81 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" 82 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h"
82 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" 83 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h"
83 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h" 84 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h"
84 #include "third_party/WebKit/WebKit/chromium/public/WebFormControlElement.h" 85 #include "third_party/WebKit/WebKit/chromium/public/WebFormControlElement.h"
85 #include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h" 86 #include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h"
86 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" 87 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
87 #include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h" 88 #include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h"
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) 630 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL)
630 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) 631 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin)
631 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) 632 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse)
632 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) 633 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
633 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, 634 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage,
634 OnGetAllSavableResourceLinksForCurrentPage) 635 OnGetAllSavableResourceLinksForCurrentPage)
635 IPC_MESSAGE_HANDLER( 636 IPC_MESSAGE_HANDLER(
636 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, 637 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks,
637 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) 638 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks)
638 IPC_MESSAGE_HANDLER(ViewMsg_GetApplicationInfo, OnGetApplicationInfo) 639 IPC_MESSAGE_HANDLER(ViewMsg_GetApplicationInfo, OnGetApplicationInfo)
640 IPC_MESSAGE_HANDLER(ViewMsg_GetAccessibilityInfo, OnGetAccessibilityInfo)
641 IPC_MESSAGE_HANDLER(ViewMsg_ClearAccessibilityInfo,
642 OnClearAccessibilityInfo)
639 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnMsgShouldClose) 643 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnMsgShouldClose)
640 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) 644 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage)
641 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) 645 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged)
642 IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost, 646 IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost,
643 OnMessageFromExternalHost) 647 OnMessageFromExternalHost)
644 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, 648 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount,
645 OnDisassociateFromPopupCount) 649 OnDisassociateFromPopupCount)
646 IPC_MESSAGE_HANDLER(ViewMsg_AutoFillSuggestionsReturned, 650 IPC_MESSAGE_HANDLER(ViewMsg_AutoFillSuggestionsReturned,
647 OnAutoFillSuggestionsReturned) 651 OnAutoFillSuggestionsReturned)
648 IPC_MESSAGE_HANDLER(ViewMsg_AutoFillForms, OnAutoFillForms) 652 IPC_MESSAGE_HANDLER(ViewMsg_AutoFillForms, OnAutoFillForms)
(...skipping 25 matching lines...) Expand all
674 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) 678 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged)
675 #endif 679 #endif
676 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, 680 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent,
677 OnSetEditCommandsForNextKeyEvent) 681 OnSetEditCommandsForNextKeyEvent)
678 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCode, 682 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCode,
679 OnExecuteCode) 683 OnExecuteCode)
680 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, 684 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction,
681 OnCustomContextMenuAction) 685 OnCustomContextMenuAction)
682 IPC_MESSAGE_HANDLER(ViewMsg_TranslatePage, OnTranslatePage) 686 IPC_MESSAGE_HANDLER(ViewMsg_TranslatePage, OnTranslatePage)
683 IPC_MESSAGE_HANDLER(ViewMsg_RevertTranslation, OnRevertTranslation) 687 IPC_MESSAGE_HANDLER(ViewMsg_RevertTranslation, OnRevertTranslation)
684 IPC_MESSAGE_HANDLER(ViewMsg_GetAccessibilityTree, OnGetAccessibilityTree)
685 688
686 // Have the super handle all other messages. 689 // Have the super handle all other messages.
687 IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message)) 690 IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message))
688 IPC_END_MESSAGE_MAP() 691 IPC_END_MESSAGE_MAP()
689 } 692 }
690 693
691 void RenderView::SendThumbnail() { 694 void RenderView::SendThumbnail() {
692 WebFrame* main_frame = webview()->mainFrame(); 695 WebFrame* main_frame = webview()->mainFrame();
693 if (!main_frame) 696 if (!main_frame)
694 return; 697 return;
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); 1328 Send(new ViewHostMsg_FrameNavigate(routing_id_, params));
1326 } 1329 }
1327 1330
1328 last_page_id_sent_to_browser_ = 1331 last_page_id_sent_to_browser_ =
1329 std::max(last_page_id_sent_to_browser_, page_id_); 1332 std::max(last_page_id_sent_to_browser_, page_id_);
1330 1333
1331 // If we end up reusing this WebRequest (for example, due to a #ref click), 1334 // If we end up reusing this WebRequest (for example, due to a #ref click),
1332 // we don't want the transition type to persist. Just clear it. 1335 // we don't want the transition type to persist. Just clear it.
1333 navigation_state->set_transition_type(PageTransition::LINK); 1336 navigation_state->set_transition_type(PageTransition::LINK);
1334 1337
1338 #if defined(OS_WIN)
1335 if (accessibility_.get()) { 1339 if (accessibility_.get()) {
1336 accessibility_->clear(); 1340 // Remove accessibility info cache.
1337 accessibility_.reset(); 1341 accessibility_.reset();
1338 } 1342 }
1343 #else
1344 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288.
1345 #endif
1339 } 1346 }
1340 1347
1341 // Tell the embedding application that the title of the active page has changed 1348 // Tell the embedding application that the title of the active page has changed
1342 void RenderView::UpdateTitle(WebFrame* frame, const string16& title) { 1349 void RenderView::UpdateTitle(WebFrame* frame, const string16& title) {
1343 // Ignore all but top level navigations... 1350 // Ignore all but top level navigations...
1344 if (!frame->parent()) { 1351 if (!frame->parent()) {
1345 Send(new ViewHostMsg_UpdateTitle( 1352 Send(new ViewHostMsg_UpdateTitle(
1346 routing_id_, 1353 routing_id_,
1347 page_id_, 1354 page_id_,
1348 UTF16ToWideHack(title.length() > chrome::kMaxTitleChars ? 1355 UTF16ToWideHack(title.length() > chrome::kMaxTitleChars ?
(...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after
3915 ExtensionProcessBindings::SetViewType(webview(), type); 3922 ExtensionProcessBindings::SetViewType(webview(), type);
3916 } 3923 }
3917 } 3924 }
3918 view_type_ = type; 3925 view_type_ = type;
3919 } 3926 }
3920 3927
3921 void RenderView::OnUpdateBrowserWindowId(int window_id) { 3928 void RenderView::OnUpdateBrowserWindowId(int window_id) {
3922 browser_window_id_ = window_id; 3929 browser_window_id_ = window_id;
3923 } 3930 }
3924 3931
3925 void RenderView::OnGetAccessibilityTree() { 3932 void RenderView::OnGetAccessibilityInfo(
3926 if (accessibility_.get()) { 3933 const webkit_glue::WebAccessibility::InParams& in_params,
3934 webkit_glue::WebAccessibility::OutParams* out_params) {
3935 #if defined(OS_WIN)
3936 if (!accessibility_.get()) {
3937 // TODO(dglazkov): Once implemented for all ports, remove lazy
3938 // instantiation of accessibility_.
3939 accessibility_.reset(WebAccessibilityCache::create());
3940 accessibility_->initialize(webview());
3941 }
3942
3943 out_params->return_code =
3944 webkit_glue::WebAccessibility::GetAccObjInfo(accessibility_.get(),
3945 in_params,
3946 out_params);
3947
3948 #else // defined(OS_WIN)
3949 // TODO(port): accessibility not yet implemented
3950 NOTIMPLEMENTED();
3951 #endif
3952 }
3953
3954 void RenderView::OnClearAccessibilityInfo(int acc_obj_id, bool clear_all) {
3955 #if defined(OS_WIN)
3956 if (!accessibility_.get()) {
3957 // If accessibility is not activated, ignore clearing message.
3958 return;
3959 }
3960
3961 if (clear_all) {
3927 accessibility_->clear(); 3962 accessibility_->clear();
3963 return;
3928 } 3964 }
3929 accessibility_.reset(WebAccessibilityCache::create());
3930 accessibility_->initialize(webview());
3931 3965
3932 WebAccessibilityObject src_tree = webview()->accessibilityObject(); 3966 accessibility_->remove(acc_obj_id);
3933 webkit_glue::WebAccessibility dst_tree(src_tree, accessibility_.get()); 3967
3934 Send(new ViewHostMsg_AccessibilityTree(routing_id_, dst_tree)); 3968 #else // defined(OS_WIN)
3969 // TODO(port): accessibility not yet implemented
3970 NOTIMPLEMENTED();
3971 #endif
3935 } 3972 }
3936 3973
3937 void RenderView::OnGetAllSavableResourceLinksForCurrentPage( 3974 void RenderView::OnGetAllSavableResourceLinksForCurrentPage(
3938 const GURL& page_url) { 3975 const GURL& page_url) {
3939 // Prepare list to storage all savable resource links. 3976 // Prepare list to storage all savable resource links.
3940 std::vector<GURL> resources_list; 3977 std::vector<GURL> resources_list;
3941 std::vector<GURL> referrers_list; 3978 std::vector<GURL> referrers_list;
3942 std::vector<GURL> frames_list; 3979 std::vector<GURL> frames_list;
3943 webkit_glue::SavableResourcesResult result(&resources_list, 3980 webkit_glue::SavableResourcesResult result(&resources_list,
3944 &referrers_list, 3981 &referrers_list,
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
4949 4986
4950 if (last_top_level_navigation_page_id_ != page_id_ && 4987 if (last_top_level_navigation_page_id_ != page_id_ &&
4951 // Not interested in reloads. 4988 // Not interested in reloads.
4952 type != WebKit::WebNavigationTypeReload && 4989 type != WebKit::WebNavigationTypeReload &&
4953 type != WebKit::WebNavigationTypeFormSubmitted) { 4990 type != WebKit::WebNavigationTypeFormSubmitted) {
4954 return true; 4991 return true;
4955 } 4992 }
4956 } 4993 }
4957 return false; 4994 return false;
4958 } 4995 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | third_party/iaccessible2/ia2_api_all.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698