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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 #endif | 678 #endif |
679 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, | 679 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, |
680 OnSetEditCommandsForNextKeyEvent) | 680 OnSetEditCommandsForNextKeyEvent) |
681 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCode, | 681 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCode, |
682 OnExecuteCode) | 682 OnExecuteCode) |
683 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, | 683 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, |
684 OnCustomContextMenuAction) | 684 OnCustomContextMenuAction) |
685 IPC_MESSAGE_HANDLER(ViewMsg_TranslatePage, OnTranslatePage) | 685 IPC_MESSAGE_HANDLER(ViewMsg_TranslatePage, OnTranslatePage) |
686 IPC_MESSAGE_HANDLER(ViewMsg_RevertTranslation, OnRevertTranslation) | 686 IPC_MESSAGE_HANDLER(ViewMsg_RevertTranslation, OnRevertTranslation) |
687 IPC_MESSAGE_HANDLER(ViewMsg_GetAccessibilityTree, OnGetAccessibilityTree) | 687 IPC_MESSAGE_HANDLER(ViewMsg_GetAccessibilityTree, OnGetAccessibilityTree) |
| 688 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityFocus, OnSetAccessibilityFocus) |
| 689 IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityDoDefaultAction, |
| 690 OnAccessibilityDoDefaultAction) |
688 | 691 |
689 // Have the super handle all other messages. | 692 // Have the super handle all other messages. |
690 IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message)) | 693 IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message)) |
691 IPC_END_MESSAGE_MAP() | 694 IPC_END_MESSAGE_MAP() |
692 } | 695 } |
693 | 696 |
694 void RenderView::SendThumbnail() { | 697 void RenderView::SendThumbnail() { |
695 WebFrame* main_frame = webview()->mainFrame(); | 698 WebFrame* main_frame = webview()->mainFrame(); |
696 if (!main_frame) | 699 if (!main_frame) |
697 return; | 700 return; |
(...skipping 3224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3922 } | 3925 } |
3923 } | 3926 } |
3924 view_type_ = type; | 3927 view_type_ = type; |
3925 } | 3928 } |
3926 | 3929 |
3927 void RenderView::OnUpdateBrowserWindowId(int window_id) { | 3930 void RenderView::OnUpdateBrowserWindowId(int window_id) { |
3928 browser_window_id_ = window_id; | 3931 browser_window_id_ = window_id; |
3929 } | 3932 } |
3930 | 3933 |
3931 void RenderView::OnGetAccessibilityTree() { | 3934 void RenderView::OnGetAccessibilityTree() { |
3932 if (accessibility_.get()) { | 3935 if (accessibility_.get()) |
3933 accessibility_->clear(); | 3936 accessibility_->clear(); |
3934 } | |
3935 accessibility_.reset(WebAccessibilityCache::create()); | 3937 accessibility_.reset(WebAccessibilityCache::create()); |
3936 accessibility_->initialize(webview()); | 3938 accessibility_->initialize(webview()); |
3937 | 3939 |
3938 WebAccessibilityObject src_tree = webview()->accessibilityObject(); | 3940 WebAccessibilityObject src_tree = webview()->accessibilityObject(); |
3939 webkit_glue::WebAccessibility dst_tree(src_tree, accessibility_.get()); | 3941 webkit_glue::WebAccessibility dst_tree(src_tree, accessibility_.get()); |
3940 Send(new ViewHostMsg_AccessibilityTree(routing_id_, dst_tree)); | 3942 Send(new ViewHostMsg_AccessibilityTree(routing_id_, dst_tree)); |
3941 } | 3943 } |
3942 | 3944 |
| 3945 void RenderView::OnSetAccessibilityFocus(int acc_obj_id) { |
| 3946 if (!accessibility_.get()) |
| 3947 return; |
| 3948 if (accessibility_->isValidId(acc_obj_id)) { |
| 3949 // TODO(dmazzoni) fix the cache so that id=1000 is not a magic number. |
| 3950 // By convention, calling SetFocus on the root of the tree (id = 1000) |
| 3951 // should clear the current focus. Otherwise set the focus to the new |
| 3952 // node. |
| 3953 if (acc_obj_id == 1000) |
| 3954 webview()->clearFocusedNode(); |
| 3955 else |
| 3956 accessibility_->getObjectById(acc_obj_id).setFocused(true); |
| 3957 } |
| 3958 } |
| 3959 |
| 3960 void RenderView::OnAccessibilityDoDefaultAction(int acc_obj_id) { |
| 3961 if (!accessibility_.get()) |
| 3962 return; |
| 3963 if (accessibility_->isValidId(acc_obj_id)) { |
| 3964 accessibility_->getObjectById(acc_obj_id).performDefaultAction(); |
| 3965 } |
| 3966 } |
| 3967 |
3943 void RenderView::OnGetAllSavableResourceLinksForCurrentPage( | 3968 void RenderView::OnGetAllSavableResourceLinksForCurrentPage( |
3944 const GURL& page_url) { | 3969 const GURL& page_url) { |
3945 // Prepare list to storage all savable resource links. | 3970 // Prepare list to storage all savable resource links. |
3946 std::vector<GURL> resources_list; | 3971 std::vector<GURL> resources_list; |
3947 std::vector<GURL> referrers_list; | 3972 std::vector<GURL> referrers_list; |
3948 std::vector<GURL> frames_list; | 3973 std::vector<GURL> frames_list; |
3949 webkit_glue::SavableResourcesResult result(&resources_list, | 3974 webkit_glue::SavableResourcesResult result(&resources_list, |
3950 &referrers_list, | 3975 &referrers_list, |
3951 &frames_list); | 3976 &frames_list); |
3952 | 3977 |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4995 | 5020 |
4996 if (last_top_level_navigation_page_id_ != page_id_ && | 5021 if (last_top_level_navigation_page_id_ != page_id_ && |
4997 // Not interested in reloads. | 5022 // Not interested in reloads. |
4998 type != WebKit::WebNavigationTypeReload && | 5023 type != WebKit::WebNavigationTypeReload && |
4999 type != WebKit::WebNavigationTypeFormSubmitted) { | 5024 type != WebKit::WebNavigationTypeFormSubmitted) { |
5000 return true; | 5025 return true; |
5001 } | 5026 } |
5002 } | 5027 } |
5003 return false; | 5028 return false; |
5004 } | 5029 } |
OLD | NEW |