OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #if defined(ENABLE_PEPPER) | 5 #if defined(ENABLE_PEPPER) |
6 #define PEPPER_APIS_ENABLED | 6 #define PEPPER_APIS_ENABLED |
7 #endif | 7 #endif |
8 | 8 |
9 #include "chrome/renderer/render_view.h" | 9 #include "chrome/renderer/render_view.h" |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #include "chrome/renderer/webplugin_delegate_pepper.h" | 57 #include "chrome/renderer/webplugin_delegate_pepper.h" |
58 #include "chrome/renderer/webplugin_delegate_proxy.h" | 58 #include "chrome/renderer/webplugin_delegate_proxy.h" |
59 #include "chrome/renderer/webworker_proxy.h" | 59 #include "chrome/renderer/webworker_proxy.h" |
60 #include "grit/generated_resources.h" | 60 #include "grit/generated_resources.h" |
61 #include "grit/renderer_resources.h" | 61 #include "grit/renderer_resources.h" |
62 #include "net/base/data_url.h" | 62 #include "net/base/data_url.h" |
63 #include "net/base/escape.h" | 63 #include "net/base/escape.h" |
64 #include "net/base/net_errors.h" | 64 #include "net/base/net_errors.h" |
65 #include "skia/ext/bitmap_platform_device.h" | 65 #include "skia/ext/bitmap_platform_device.h" |
66 #include "skia/ext/image_operations.h" | 66 #include "skia/ext/image_operations.h" |
| 67 #include "webkit/api/public/WebAccessibilityCache.h" |
67 #include "webkit/api/public/WebAccessibilityObject.h" | 68 #include "webkit/api/public/WebAccessibilityObject.h" |
68 #include "webkit/api/public/WebDataSource.h" | 69 #include "webkit/api/public/WebDataSource.h" |
69 #include "webkit/api/public/WebDevToolsAgent.h" | 70 #include "webkit/api/public/WebDevToolsAgent.h" |
70 #include "webkit/api/public/WebDragData.h" | 71 #include "webkit/api/public/WebDragData.h" |
71 #include "webkit/api/public/WebForm.h" | 72 #include "webkit/api/public/WebForm.h" |
72 #include "webkit/api/public/WebFrame.h" | 73 #include "webkit/api/public/WebFrame.h" |
73 #include "webkit/api/public/WebHistoryItem.h" | 74 #include "webkit/api/public/WebHistoryItem.h" |
74 #include "webkit/api/public/WebNode.h" | 75 #include "webkit/api/public/WebNode.h" |
75 #include "webkit/api/public/WebPoint.h" | 76 #include "webkit/api/public/WebPoint.h" |
76 #include "webkit/api/public/WebRect.h" | 77 #include "webkit/api/public/WebRect.h" |
(...skipping 30 matching lines...) Expand all Loading... |
107 #include "app/gfx/native_theme_win.h" | 108 #include "app/gfx/native_theme_win.h" |
108 #endif | 109 #endif |
109 | 110 |
110 using base::Time; | 111 using base::Time; |
111 using base::TimeDelta; | 112 using base::TimeDelta; |
112 using webkit_glue::AltErrorPageResourceFetcher; | 113 using webkit_glue::AltErrorPageResourceFetcher; |
113 using webkit_glue::FormFieldValues; | 114 using webkit_glue::FormFieldValues; |
114 using webkit_glue::ImageResourceFetcher; | 115 using webkit_glue::ImageResourceFetcher; |
115 using webkit_glue::PasswordForm; | 116 using webkit_glue::PasswordForm; |
116 using webkit_glue::PasswordFormDomManager; | 117 using webkit_glue::PasswordFormDomManager; |
| 118 using WebKit::WebAccessibilityCache; |
117 using WebKit::WebAccessibilityObject; | 119 using WebKit::WebAccessibilityObject; |
118 using WebKit::WebColor; | 120 using WebKit::WebColor; |
119 using WebKit::WebColorName; | 121 using WebKit::WebColorName; |
120 using WebKit::WebConsoleMessage; | 122 using WebKit::WebConsoleMessage; |
121 using WebKit::WebContextMenuData; | 123 using WebKit::WebContextMenuData; |
122 using WebKit::WebData; | 124 using WebKit::WebData; |
123 using WebKit::WebDataSource; | 125 using WebKit::WebDataSource; |
124 using WebKit::WebDevToolsAgent; | 126 using WebKit::WebDevToolsAgent; |
125 using WebKit::WebDragData; | 127 using WebKit::WebDragData; |
126 using WebKit::WebDragOperation; | 128 using WebKit::WebDragOperation; |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 } | 1091 } |
1090 | 1092 |
1091 last_page_id_sent_to_browser_ = | 1093 last_page_id_sent_to_browser_ = |
1092 std::max(last_page_id_sent_to_browser_, page_id_); | 1094 std::max(last_page_id_sent_to_browser_, page_id_); |
1093 | 1095 |
1094 // If we end up reusing this WebRequest (for example, due to a #ref click), | 1096 // If we end up reusing this WebRequest (for example, due to a #ref click), |
1095 // we don't want the transition type to persist. Just clear it. | 1097 // we don't want the transition type to persist. Just clear it. |
1096 navigation_state->set_transition_type(PageTransition::LINK); | 1098 navigation_state->set_transition_type(PageTransition::LINK); |
1097 | 1099 |
1098 #if defined(OS_WIN) | 1100 #if defined(OS_WIN) |
1099 if (web_accessibility_manager_.get()) { | 1101 if (accessibility_.get()) { |
1100 // Clear accessibility info cache. | 1102 // Clear accessibility info cache. |
1101 web_accessibility_manager_->ClearAccObjMap(-1, true); | 1103 accessibility_->clear(); |
1102 } | 1104 } |
1103 #else | 1105 #else |
1104 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. | 1106 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. |
1105 #endif | 1107 #endif |
1106 } | 1108 } |
1107 | 1109 |
1108 // Tell the embedding application that the title of the active page has changed | 1110 // Tell the embedding application that the title of the active page has changed |
1109 void RenderView::UpdateTitle(WebFrame* frame, const string16& title) { | 1111 void RenderView::UpdateTitle(WebFrame* frame, const string16& title) { |
1110 // Ignore all but top level navigations... | 1112 // Ignore all but top level navigations... |
1111 if (!frame->parent()) { | 1113 if (!frame->parent()) { |
(...skipping 2021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3133 void RenderView::OnUpdateBackForwardListCount(int back_list_count, | 3135 void RenderView::OnUpdateBackForwardListCount(int back_list_count, |
3134 int forward_list_count) { | 3136 int forward_list_count) { |
3135 history_back_list_count_ = back_list_count; | 3137 history_back_list_count_ = back_list_count; |
3136 history_forward_list_count_ = forward_list_count; | 3138 history_forward_list_count_ = forward_list_count; |
3137 } | 3139 } |
3138 | 3140 |
3139 void RenderView::OnGetAccessibilityInfo( | 3141 void RenderView::OnGetAccessibilityInfo( |
3140 const webkit_glue::WebAccessibility::InParams& in_params, | 3142 const webkit_glue::WebAccessibility::InParams& in_params, |
3141 webkit_glue::WebAccessibility::OutParams* out_params) { | 3143 webkit_glue::WebAccessibility::OutParams* out_params) { |
3142 #if defined(OS_WIN) | 3144 #if defined(OS_WIN) |
3143 if (!web_accessibility_manager_.get()) { | 3145 if (!accessibility_.get()) { |
3144 web_accessibility_manager_.reset( | 3146 // TODO(dglazkov): Once implemented for all ports, remove lazy |
3145 webkit_glue::WebAccessibilityManager::Create()); | 3147 // instantiation of accessibility_. |
| 3148 accessibility_.reset(WebAccessibilityCache::create()); |
| 3149 accessibility_->initialize(webview()); |
3146 } | 3150 } |
3147 | 3151 |
3148 if (!web_accessibility_manager_->GetAccObjInfo(webview(), in_params, | 3152 webkit_glue::WebAccessibility::GetAccObjInfo(accessibility_.get(), |
3149 out_params)) { | 3153 in_params, |
3150 return; | 3154 out_params); |
3151 } | 3155 |
3152 #else // defined(OS_WIN) | 3156 #else // defined(OS_WIN) |
3153 // TODO(port): accessibility not yet implemented | 3157 // TODO(port): accessibility not yet implemented |
3154 NOTIMPLEMENTED(); | 3158 NOTIMPLEMENTED(); |
3155 #endif | 3159 #endif |
3156 } | 3160 } |
3157 | 3161 |
3158 void RenderView::OnClearAccessibilityInfo(int acc_obj_id, bool clear_all) { | 3162 void RenderView::OnClearAccessibilityInfo(int acc_obj_id, bool clear_all) { |
3159 #if defined(OS_WIN) | 3163 #if defined(OS_WIN) |
3160 if (!web_accessibility_manager_.get()) { | 3164 if (!accessibility_.get()) { |
3161 // If accessibility is not activated, ignore clearing message. | 3165 // If accessibility is not activated, ignore clearing message. |
3162 return; | 3166 return; |
3163 } | 3167 } |
3164 | 3168 |
3165 if (!web_accessibility_manager_->ClearAccObjMap(acc_obj_id, clear_all)) | 3169 if (clear_all) { |
| 3170 accessibility_->clear(); |
3166 return; | 3171 return; |
| 3172 } |
| 3173 |
| 3174 accessibility_->remove(acc_obj_id); |
3167 | 3175 |
3168 #else // defined(OS_WIN) | 3176 #else // defined(OS_WIN) |
3169 // TODO(port): accessibility not yet implemented | 3177 // TODO(port): accessibility not yet implemented |
3170 NOTIMPLEMENTED(); | 3178 NOTIMPLEMENTED(); |
3171 #endif | 3179 #endif |
3172 } | 3180 } |
3173 | 3181 |
3174 void RenderView::OnGetAllSavableResourceLinksForCurrentPage( | 3182 void RenderView::OnGetAllSavableResourceLinksForCurrentPage( |
3175 const GURL& page_url) { | 3183 const GURL& page_url) { |
3176 // Prepare list to storage all savable resource links. | 3184 // Prepare list to storage all savable resource links. |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3623 // TODO(mbelshe): should we log more stats? | 3631 // TODO(mbelshe): should we log more stats? |
3624 LOG(INFO) << "PLT: " | 3632 LOG(INFO) << "PLT: " |
3625 << (finish - start).InMilliseconds() | 3633 << (finish - start).InMilliseconds() |
3626 << "ms " | 3634 << "ms " |
3627 << url.spec(); | 3635 << url.spec(); |
3628 } | 3636 } |
3629 | 3637 |
3630 void RenderView::focusAccessibilityObject( | 3638 void RenderView::focusAccessibilityObject( |
3631 const WebAccessibilityObject& acc_obj) { | 3639 const WebAccessibilityObject& acc_obj) { |
3632 #if defined(OS_WIN) | 3640 #if defined(OS_WIN) |
3633 if (!web_accessibility_manager_.get()) { | 3641 // TODO(dglazkov): Current logic implies that focus change can only be made |
3634 web_accessibility_manager_.reset( | 3642 // after at least one call to RenderView::OnGetAccessibilityInfo, which is |
3635 webkit_glue::WebAccessibilityManager::Create()); | 3643 // where accessibility is initialized. We should determine whether that's |
3636 } | 3644 // right. |
| 3645 if (!accessibility_.get()) |
| 3646 return; |
3637 | 3647 |
3638 // Retrieve the accessibility object id of the AccessibilityObject. | 3648 // Retrieve the accessibility object id of the AccessibilityObject. |
3639 int acc_obj_id = web_accessibility_manager_->FocusAccObj(acc_obj); | 3649 int acc_obj_id = accessibility_->addOrGetId(acc_obj); |
3640 | 3650 |
3641 // If id is valid, alert the browser side that an accessibility focus change | 3651 // If id is valid, alert the browser side that an accessibility focus change |
3642 // occurred. | 3652 // occurred. |
3643 if (acc_obj_id >= 0) | 3653 if (acc_obj_id >= 0) |
3644 Send(new ViewHostMsg_AccessibilityFocusChange(routing_id_, acc_obj_id)); | 3654 Send(new ViewHostMsg_AccessibilityFocusChange(routing_id_, acc_obj_id)); |
3645 | 3655 |
3646 #else // defined(OS_WIN) | 3656 #else // defined(OS_WIN) |
3647 // TODO(port): accessibility not yet implemented | 3657 // TODO(port): accessibility not yet implemented |
3648 NOTIMPLEMENTED(); | 3658 NOTIMPLEMENTED(); |
3649 #endif | 3659 #endif |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3753 new PluginMsg_SignalModalDialogEvent(host_window_)); | 3763 new PluginMsg_SignalModalDialogEvent(host_window_)); |
3754 | 3764 |
3755 message->EnableMessagePumping(); // Runs a nested message loop. | 3765 message->EnableMessagePumping(); // Runs a nested message loop. |
3756 bool rv = Send(message); | 3766 bool rv = Send(message); |
3757 | 3767 |
3758 PluginChannelHost::Broadcast( | 3768 PluginChannelHost::Broadcast( |
3759 new PluginMsg_ResetModalDialogEvent(host_window_)); | 3769 new PluginMsg_ResetModalDialogEvent(host_window_)); |
3760 | 3770 |
3761 return rv; | 3771 return rv; |
3762 } | 3772 } |
OLD | NEW |