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 <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "app/l10n_util.h" |
12 #include "app/message_box_flags.h" | 13 #include "app/message_box_flags.h" |
13 #include "app/l10n_util.h" | |
14 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
18 #include "base/metrics/field_trial.h" | 18 #include "base/metrics/field_trial.h" |
19 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/process_util.h" | 21 #include "base/process_util.h" |
22 #include "base/singleton.h" | 22 #include "base/singleton.h" |
23 #include "base/string_piece.h" | 23 #include "base/string_piece.h" |
24 #include "base/string_util.h" | 24 #include "base/string_util.h" |
| 25 #include "base/sys_string_conversions.h" |
25 #include "base/time.h" | 26 #include "base/time.h" |
26 #include "base/sys_string_conversions.h" | |
27 #include "base/utf_string_conversions.h" | 27 #include "base/utf_string_conversions.h" |
28 #include "build/build_config.h" | 28 #include "build/build_config.h" |
29 #include "chrome/common/appcache/appcache_dispatcher.h" | 29 #include "chrome/common/appcache/appcache_dispatcher.h" |
30 #include "chrome/common/bindings_policy.h" | 30 #include "chrome/common/bindings_policy.h" |
31 #include "chrome/common/child_process_logging.h" | 31 #include "chrome/common/child_process_logging.h" |
32 #include "chrome/common/chrome_constants.h" | 32 #include "chrome/common/chrome_constants.h" |
33 #include "chrome/common/chrome_paths.h" | 33 #include "chrome/common/chrome_paths.h" |
34 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
35 #include "chrome/common/extensions/extension.h" | 35 #include "chrome/common/extensions/extension.h" |
36 #include "chrome/common/file_system/file_system_dispatcher.h" | 36 #include "chrome/common/file_system/file_system_dispatcher.h" |
(...skipping 12 matching lines...) Expand all Loading... |
49 #include "chrome/renderer/audio_message_filter.h" | 49 #include "chrome/renderer/audio_message_filter.h" |
50 #include "chrome/renderer/autofill_helper.h" | 50 #include "chrome/renderer/autofill_helper.h" |
51 #include "chrome/renderer/automation/dom_automation_controller.h" | 51 #include "chrome/renderer/automation/dom_automation_controller.h" |
52 #include "chrome/renderer/blocked_plugin.h" | 52 #include "chrome/renderer/blocked_plugin.h" |
53 #include "chrome/renderer/device_orientation_dispatcher.h" | 53 #include "chrome/renderer/device_orientation_dispatcher.h" |
54 #include "chrome/renderer/devtools_agent.h" | 54 #include "chrome/renderer/devtools_agent.h" |
55 #include "chrome/renderer/devtools_client.h" | 55 #include "chrome/renderer/devtools_client.h" |
56 #include "chrome/renderer/dom_ui_bindings.h" | 56 #include "chrome/renderer/dom_ui_bindings.h" |
57 #include "chrome/renderer/extension_groups.h" | 57 #include "chrome/renderer/extension_groups.h" |
58 #include "chrome/renderer/extensions/bindings_utils.h" | 58 #include "chrome/renderer/extensions/bindings_utils.h" |
59 #include "chrome/renderer/extensions/extension_renderer_info.h" | |
60 #include "chrome/renderer/extensions/event_bindings.h" | 59 #include "chrome/renderer/extensions/event_bindings.h" |
61 #include "chrome/renderer/extensions/extension_process_bindings.h" | 60 #include "chrome/renderer/extensions/extension_process_bindings.h" |
| 61 #include "chrome/renderer/extensions/extension_renderer_info.h" |
62 #include "chrome/renderer/extensions/renderer_extension_bindings.h" | 62 #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
63 #include "chrome/renderer/external_host_bindings.h" | 63 #include "chrome/renderer/external_host_bindings.h" |
64 #include "chrome/renderer/geolocation_dispatcher.h" | 64 #include "chrome/renderer/geolocation_dispatcher.h" |
65 #include "chrome/renderer/ggl/ggl.h" | 65 #include "chrome/renderer/ggl/ggl.h" |
66 #include "chrome/renderer/localized_error.h" | 66 #include "chrome/renderer/localized_error.h" |
67 #include "chrome/renderer/media/audio_renderer_impl.h" | 67 #include "chrome/renderer/media/audio_renderer_impl.h" |
68 #include "chrome/renderer/media/ipc_video_decoder.h" | 68 #include "chrome/renderer/media/ipc_video_decoder.h" |
69 #include "chrome/renderer/media/ipc_video_renderer.h" | 69 #include "chrome/renderer/media/ipc_video_renderer.h" |
70 #include "chrome/renderer/navigation_state.h" | 70 #include "chrome/renderer/navigation_state.h" |
71 #include "chrome/renderer/notification_provider.h" | 71 #include "chrome/renderer/notification_provider.h" |
(...skipping 22 matching lines...) Expand all Loading... |
94 #include "gfx/point.h" | 94 #include "gfx/point.h" |
95 #include "gfx/rect.h" | 95 #include "gfx/rect.h" |
96 #include "grit/generated_resources.h" | 96 #include "grit/generated_resources.h" |
97 #include "grit/renderer_resources.h" | 97 #include "grit/renderer_resources.h" |
98 #include "media/base/media_switches.h" | 98 #include "media/base/media_switches.h" |
99 #include "net/base/data_url.h" | 99 #include "net/base/data_url.h" |
100 #include "net/base/escape.h" | 100 #include "net/base/escape.h" |
101 #include "net/base/net_errors.h" | 101 #include "net/base/net_errors.h" |
102 #include "skia/ext/bitmap_platform_device.h" | 102 #include "skia/ext/bitmap_platform_device.h" |
103 #include "skia/ext/image_operations.h" | 103 #include "skia/ext/image_operations.h" |
104 #include "third_party/cld/encodings/compact_lang_det/win/cld_unicodetext.h" | |
105 #include "third_party/skia/include/core/SkBitmap.h" | |
106 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h" | 104 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h" |
107 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" | 105 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" |
108 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" | 106 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" |
109 #include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h" | 107 #include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h" |
110 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h" | 108 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h" |
111 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" | 109 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" |
112 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" | 110 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" |
113 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h" | 111 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h" |
114 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" | |
115 #include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" | 112 #include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" |
116 #include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h" | 113 #include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h" |
| 114 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" |
117 #include "third_party/WebKit/WebKit/chromium/public/WebFormControlElement.h" | 115 #include "third_party/WebKit/WebKit/chromium/public/WebFormControlElement.h" |
118 #include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h" | 116 #include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h" |
119 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 117 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
120 #include "third_party/WebKit/WebKit/chromium/public/WebGraphicsContext3D.h" | 118 #include "third_party/WebKit/WebKit/chromium/public/WebGraphicsContext3D.h" |
121 #include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h" | 119 #include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h" |
122 #include "third_party/WebKit/WebKit/chromium/public/WebImage.h" | 120 #include "third_party/WebKit/WebKit/chromium/public/WebImage.h" |
123 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" | 121 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" |
124 #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" | 122 #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" |
125 #include "third_party/WebKit/WebKit/chromium/public/WebNodeList.h" | 123 #include "third_party/WebKit/WebKit/chromium/public/WebNodeList.h" |
126 #include "third_party/WebKit/WebKit/chromium/public/WebPageSerializer.h" | 124 #include "third_party/WebKit/WebKit/chromium/public/WebPageSerializer.h" |
127 #include "third_party/WebKit/WebKit/chromium/public/WebPlugin.h" | 125 #include "third_party/WebKit/WebKit/chromium/public/WebPlugin.h" |
128 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h" | 126 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h" |
| 127 #include "third_party/WebKit/WebKit/chromium/public/WebPluginDocument.h" |
129 #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" | 128 #include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h" |
130 #include "third_party/WebKit/WebKit/chromium/public/WebPluginDocument.h" | |
131 #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" | 129 #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" |
132 #include "third_party/WebKit/WebKit/chromium/public/WebRange.h" | 130 #include "third_party/WebKit/WebKit/chromium/public/WebRange.h" |
133 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" | 131 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" |
134 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" | 132 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" |
135 #include "third_party/WebKit/WebKit/chromium/public/WebSearchableFormData.h" | 133 #include "third_party/WebKit/WebKit/chromium/public/WebSearchableFormData.h" |
136 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" | 134 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" |
137 #include "third_party/WebKit/WebKit/chromium/public/WebSettings.h" | 135 #include "third_party/WebKit/WebKit/chromium/public/WebSettings.h" |
138 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" | 136 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" |
139 #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h" | 137 #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h" |
140 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 138 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
141 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 139 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
142 #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" | 140 #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" |
143 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" | 141 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" |
144 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" | 142 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" |
145 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" | 143 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" |
146 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 144 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
147 #include "third_party/WebKit/WebKit/chromium/public/WebWindowFeatures.h" | 145 #include "third_party/WebKit/WebKit/chromium/public/WebWindowFeatures.h" |
| 146 #include "third_party/cld/encodings/compact_lang_det/win/cld_unicodetext.h" |
| 147 #include "third_party/skia/include/core/SkBitmap.h" |
148 #include "v8/include/v8.h" | 148 #include "v8/include/v8.h" |
149 #include "webkit/appcache/web_application_cache_host_impl.h" | 149 #include "webkit/appcache/web_application_cache_host_impl.h" |
150 #include "webkit/glue/context_menu.h" | 150 #include "webkit/glue/context_menu.h" |
151 #include "webkit/glue/dom_operations.h" | 151 #include "webkit/glue/dom_operations.h" |
152 #include "webkit/glue/form_data.h" | 152 #include "webkit/glue/form_data.h" |
153 #include "webkit/glue/form_field.h" | 153 #include "webkit/glue/form_field.h" |
154 #include "webkit/glue/glue_serialize.h" | 154 #include "webkit/glue/glue_serialize.h" |
155 #include "webkit/glue/image_decoder.h" | 155 #include "webkit/glue/image_decoder.h" |
156 #include "webkit/glue/image_resource_fetcher.h" | 156 #include "webkit/glue/image_resource_fetcher.h" |
157 #include "webkit/glue/media/buffered_data_source.h" | 157 #include "webkit/glue/media/buffered_data_source.h" |
(...skipping 20 matching lines...) Expand all Loading... |
178 #elif defined(USE_X11) | 178 #elif defined(USE_X11) |
179 #include "gfx/native_theme_linux.h" | 179 #include "gfx/native_theme_linux.h" |
180 #include "third_party/WebKit/WebKit/chromium/public/linux/WebRenderTheme.h" | 180 #include "third_party/WebKit/WebKit/chromium/public/linux/WebRenderTheme.h" |
181 #elif defined(OS_MACOSX) | 181 #elif defined(OS_MACOSX) |
182 #include "skia/ext/skia_utils_mac.h" | 182 #include "skia/ext/skia_utils_mac.h" |
183 #endif | 183 #endif |
184 | 184 |
185 using appcache::WebApplicationCacheHostImpl; | 185 using appcache::WebApplicationCacheHostImpl; |
186 using base::Time; | 186 using base::Time; |
187 using base::TimeDelta; | 187 using base::TimeDelta; |
188 using webkit_glue::AltErrorPageResourceFetcher; | |
189 using webkit_glue::FormData; | |
190 using webkit_glue::FormField; | |
191 using webkit_glue::ImageResourceFetcher; | |
192 using webkit_glue::PasswordForm; | |
193 using webkit_glue::PasswordFormDomManager; | |
194 using webkit_glue::SiteIsolationMetrics; | |
195 using webkit_glue::WebAccessibility; | |
196 using WebKit::WebAccessibilityCache; | 188 using WebKit::WebAccessibilityCache; |
197 using WebKit::WebAccessibilityNotification; | 189 using WebKit::WebAccessibilityNotification; |
198 using WebKit::WebAccessibilityObject; | 190 using WebKit::WebAccessibilityObject; |
199 using WebKit::WebApplicationCacheHost; | 191 using WebKit::WebApplicationCacheHost; |
200 using WebKit::WebApplicationCacheHostClient; | 192 using WebKit::WebApplicationCacheHostClient; |
201 using WebKit::WebColor; | 193 using WebKit::WebColor; |
202 using WebKit::WebColorName; | 194 using WebKit::WebColorName; |
203 using WebKit::WebConsoleMessage; | 195 using WebKit::WebConsoleMessage; |
204 using WebKit::WebContextMenuData; | 196 using WebKit::WebContextMenuData; |
205 using WebKit::WebCookieJar; | 197 using WebKit::WebCookieJar; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 using WebKit::WebString; | 240 using WebKit::WebString; |
249 using WebKit::WebTextAffinity; | 241 using WebKit::WebTextAffinity; |
250 using WebKit::WebTextDirection; | 242 using WebKit::WebTextDirection; |
251 using WebKit::WebURL; | 243 using WebKit::WebURL; |
252 using WebKit::WebURLError; | 244 using WebKit::WebURLError; |
253 using WebKit::WebURLRequest; | 245 using WebKit::WebURLRequest; |
254 using WebKit::WebURLResponse; | 246 using WebKit::WebURLResponse; |
255 using WebKit::WebVector; | 247 using WebKit::WebVector; |
256 using WebKit::WebView; | 248 using WebKit::WebView; |
257 using WebKit::WebWidget; | 249 using WebKit::WebWidget; |
| 250 using WebKit::WebWindowFeatures; |
258 using WebKit::WebWorker; | 251 using WebKit::WebWorker; |
259 using WebKit::WebWorkerClient; | 252 using WebKit::WebWorkerClient; |
260 using WebKit::WebWindowFeatures; | 253 using webkit_glue::AltErrorPageResourceFetcher; |
| 254 using webkit_glue::FormData; |
| 255 using webkit_glue::FormField; |
| 256 using webkit_glue::ImageResourceFetcher; |
| 257 using webkit_glue::PasswordForm; |
| 258 using webkit_glue::PasswordFormDomManager; |
| 259 using webkit_glue::SiteIsolationMetrics; |
| 260 using webkit_glue::WebAccessibility; |
261 | 261 |
262 //----------------------------------------------------------------------------- | 262 //----------------------------------------------------------------------------- |
263 | 263 |
264 typedef std::map<WebKit::WebView*, RenderView*> ViewMap; | 264 typedef std::map<WebKit::WebView*, RenderView*> ViewMap; |
265 | 265 |
266 // define to write the time necessary for thumbnail/DOM text retrieval, | 266 // define to write the time necessary for thumbnail/DOM text retrieval, |
267 // respectively, into the system debug log | 267 // respectively, into the system debug log |
268 // #define TIME_TEXT_RETRIEVAL | 268 // #define TIME_TEXT_RETRIEVAL |
269 | 269 |
270 // maximum number of characters in the document to index, any text beyond this | 270 // maximum number of characters in the document to index, any text beyond this |
(...skipping 21 matching lines...) Expand all Loading... |
292 // current content state during tab closing we use a shorter timeout for the | 292 // current content state during tab closing we use a shorter timeout for the |
293 // foreground renderer. This means there is a small window of time from which | 293 // foreground renderer. This means there is a small window of time from which |
294 // content state is modified and not sent to session restore, but this is | 294 // content state is modified and not sent to session restore, but this is |
295 // better than having to wake up all renderers during shutdown. | 295 // better than having to wake up all renderers during shutdown. |
296 static const int kDelaySecondsForContentStateSyncHidden = 5; | 296 static const int kDelaySecondsForContentStateSyncHidden = 5; |
297 static const int kDelaySecondsForContentStateSync = 1; | 297 static const int kDelaySecondsForContentStateSync = 1; |
298 | 298 |
299 // The maximum number of popups that can be spawned from one page. | 299 // The maximum number of popups that can be spawned from one page. |
300 static const int kMaximumNumberOfUnacknowledgedPopups = 25; | 300 static const int kMaximumNumberOfUnacknowledgedPopups = 25; |
301 | 301 |
302 static const char* const kUnreachableWebDataURL = | 302 static const char kUnreachableWebDataURL[] = "chrome://chromewebdata/"; |
303 "chrome://chromewebdata/"; | 303 static const char kBackForwardNavigationScheme[] = "history"; |
304 | |
305 static const char* const kBackForwardNavigationScheme = "history"; | |
306 | 304 |
307 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { | 305 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { |
308 WebVector<WebURL> urls; | 306 WebVector<WebURL> urls; |
309 ds->redirectChain(urls); | 307 ds->redirectChain(urls); |
310 result->reserve(urls.size()); | 308 result->reserve(urls.size()); |
311 for (size_t i = 0; i < urls.size(); ++i) | 309 for (size_t i = 0; i < urls.size(); ++i) |
312 result->push_back(urls[i]); | 310 result->push_back(urls[i]); |
313 } | 311 } |
314 | 312 |
315 static bool PaintViewIntoCanvas(WebView* view, | 313 static bool PaintViewIntoCanvas(WebView* view, |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 void RenderView::UserMetricsRecordAction(const std::string& action) { | 564 void RenderView::UserMetricsRecordAction(const std::string& action) { |
567 Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action)); | 565 Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action)); |
568 } | 566 } |
569 | 567 |
570 void RenderView::PluginCrashed(const FilePath& plugin_path) { | 568 void RenderView::PluginCrashed(const FilePath& plugin_path) { |
571 Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path)); | 569 Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path)); |
572 } | 570 } |
573 | 571 |
574 WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, | 572 WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, |
575 const WebPluginParams& params) { | 573 const WebPluginParams& params) { |
576 std::vector<WebPluginInfo> info; | 574 WebPluginInfo info; |
577 std::vector<ContentSetting> settings; | 575 bool found; |
578 std::vector<std::string> mime_types; | 576 ContentSetting setting; |
579 Send(new ViewHostMsg_GetPluginInfoArray( | 577 std::string mime_type; |
580 params.url, frame->top()->url(), params.mimeType.utf8(), | 578 Send(new ViewHostMsg_GetPluginInfo( |
581 &info, &settings, &mime_types)); | 579 params.url, frame->top()->url(), params.mimeType.utf8(), &found, |
582 | 580 &info, &setting, &mime_type)); |
583 // Select the first plugin returned, but only if it's enabled. | 581 if (!found || !info.enabled) |
584 if (info.empty() || !info[0].enabled) | |
585 return NULL; | 582 return NULL; |
586 scoped_refptr<pepper::PluginModule> pepper_module = | 583 scoped_refptr<pepper::PluginModule> pepper_module = |
587 PepperPluginRegistry::GetInstance()->GetModule(info[0].path); | 584 PepperPluginRegistry::GetInstance()->GetModule(info.path); |
588 if (pepper_module) | 585 if (pepper_module) |
589 return CreatePepperPlugin(frame, params, info[0].path, pepper_module.get()); | 586 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); |
590 else | 587 else |
591 return CreateNPAPIPlugin(frame, params, info[0].path, mime_types[0]); | 588 return CreateNPAPIPlugin(frame, params, info.path, mime_type); |
592 } | 589 } |
593 | 590 |
594 void RenderView::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) { | 591 void RenderView::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) { |
595 plugin_delegates_.insert(delegate); | 592 plugin_delegates_.insert(delegate); |
596 // If the renderer is visible, set initial visibility and focus state. | 593 // If the renderer is visible, set initial visibility and focus state. |
597 if (!is_hidden()) { | 594 if (!is_hidden()) { |
598 #if defined(OS_MACOSX) | 595 #if defined(OS_MACOSX) |
599 delegate->SetContainerVisibility(true); | 596 delegate->SetContainerVisibility(true); |
600 if (webview() && webview()->isActive()) | 597 if (webview() && webview()->isActive()) |
601 delegate->SetWindowFocus(true); | 598 delegate->SetWindowFocus(true); |
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 if (RenderThread::current()) // Will be NULL during unit tests. | 2371 if (RenderThread::current()) // Will be NULL during unit tests. |
2375 RenderThread::current()->DoNotSuspendWebKitSharedTimer(); | 2372 RenderThread::current()->DoNotSuspendWebKitSharedTimer(); |
2376 | 2373 |
2377 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(routing_id_)); | 2374 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(routing_id_)); |
2378 } | 2375 } |
2379 | 2376 |
2380 // WebKit::WebFrameClient ----------------------------------------------------- | 2377 // WebKit::WebFrameClient ----------------------------------------------------- |
2381 | 2378 |
2382 WebPlugin* RenderView::createPlugin(WebFrame* frame, | 2379 WebPlugin* RenderView::createPlugin(WebFrame* frame, |
2383 const WebPluginParams& params) { | 2380 const WebPluginParams& params) { |
2384 std::vector<ContentSetting> settings; | 2381 bool found = false; |
| 2382 ContentSetting setting = CONTENT_SETTING_DEFAULT; |
2385 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 2383 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
2386 std::vector<WebPluginInfo> info; | 2384 WebPluginInfo info; |
2387 GURL url(params.url); | 2385 GURL url(params.url); |
2388 std::vector<std::string> actual_mime_types; | 2386 std::string actual_mime_type; |
2389 Send(new ViewHostMsg_GetPluginInfoArray(url, | 2387 Send(new ViewHostMsg_GetPluginInfo(url, |
2390 frame->top()->url(), | 2388 frame->top()->url(), |
2391 params.mimeType.utf8(), | 2389 params.mimeType.utf8(), |
2392 &info, | 2390 &found, |
2393 &settings, | 2391 &info, |
2394 &actual_mime_types)); | 2392 &setting, |
| 2393 &actual_mime_type)); |
2395 | 2394 |
2396 if (info.empty()) | 2395 if (!found) |
2397 return NULL; | 2396 return NULL; |
| 2397 DCHECK(setting != CONTENT_SETTING_DEFAULT); |
2398 | 2398 |
2399 DCHECK(settings[0] != CONTENT_SETTING_DEFAULT); | 2399 scoped_ptr<PluginGroup> group(PluginGroup::CopyOrCreatePluginGroup(info)); |
| 2400 group->AddPlugin(info, 0); |
2400 | 2401 |
2401 scoped_ptr<PluginGroup> group(PluginGroup::CopyOrCreatePluginGroup(info[0])); | 2402 if (!info.enabled) { |
2402 group->AddPlugin(info[0], 0); | |
2403 | |
2404 if (!info[0].enabled) { | |
2405 if (cmd->HasSwitch(switches::kDisableOutdatedPlugins) && | 2403 if (cmd->HasSwitch(switches::kDisableOutdatedPlugins) && |
2406 group->IsVulnerable()) { | 2404 group->IsVulnerable()) { |
2407 Send(new ViewHostMsg_DisabledOutdatedPlugin(routing_id_, | 2405 Send(new ViewHostMsg_DisabledOutdatedPlugin(routing_id_, |
2408 group->GetGroupName(), | 2406 group->GetGroupName(), |
2409 GURL(group->GetUpdateURL()))); | 2407 GURL(group->GetUpdateURL()))); |
2410 return CreateOutdatedPluginPlaceholder(frame, params, group.get()); | 2408 return CreateOutdatedPluginPlaceholder(frame, params, group.get()); |
2411 } | 2409 } |
2412 return NULL; | 2410 return NULL; |
2413 } | 2411 } |
2414 | 2412 |
2415 if (info[0].path.value() == kDefaultPluginLibraryName || | 2413 if (info.path.value() == kDefaultPluginLibraryName || |
2416 settings[0] == CONTENT_SETTING_ALLOW) { | 2414 setting == CONTENT_SETTING_ALLOW) { |
2417 scoped_refptr<pepper::PluginModule> pepper_module = | 2415 scoped_refptr<pepper::PluginModule> pepper_module = |
2418 PepperPluginRegistry::GetInstance()->GetModule(info[0].path); | 2416 PepperPluginRegistry::GetInstance()->GetModule(info.path); |
2419 if (pepper_module) { | 2417 if (pepper_module) { |
2420 return CreatePepperPlugin(frame, | 2418 return CreatePepperPlugin(frame, |
2421 params, | 2419 params, |
2422 info[0].path, | 2420 info.path, |
2423 pepper_module.get()); | 2421 pepper_module.get()); |
2424 } | 2422 } |
2425 return CreateNPAPIPlugin(frame, params, info[0].path, actual_mime_types[0]); | 2423 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); |
2426 } | 2424 } |
2427 std::string resource; | 2425 std::string resource; |
2428 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) | 2426 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) |
2429 resource = group->identifier(); | 2427 resource = group->identifier(); |
2430 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, resource); | 2428 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, resource); |
2431 int resource_id; | 2429 int resource_id; |
2432 int message_id; | 2430 int message_id; |
2433 if (settings[0] == CONTENT_SETTING_ASK) { | 2431 if (setting == CONTENT_SETTING_ASK) { |
2434 resource_id = IDR_BLOCKED_PLUGIN_HTML; | 2432 resource_id = IDR_BLOCKED_PLUGIN_HTML; |
2435 message_id = IDS_PLUGIN_LOAD; | 2433 message_id = IDS_PLUGIN_LOAD; |
2436 } else { | 2434 } else { |
2437 resource_id = IDR_OUTDATED_PLUGIN_HTML; | 2435 resource_id = IDR_OUTDATED_PLUGIN_HTML; |
2438 message_id = IDS_PLUGIN_BLOCKED; | 2436 message_id = IDS_PLUGIN_BLOCKED; |
2439 } | 2437 } |
2440 | |
2441 // |blocked_plugin| will delete itself when the WebViewPlugin | 2438 // |blocked_plugin| will delete itself when the WebViewPlugin |
2442 // is destroyed. | 2439 // is destroyed. |
2443 BlockedPlugin* blocked_plugin = | 2440 BlockedPlugin* blocked_plugin = |
2444 new BlockedPlugin(this, | 2441 new BlockedPlugin(this, |
2445 frame, | 2442 frame, |
2446 params, | 2443 params, |
2447 webkit_preferences_, | 2444 webkit_preferences_, |
2448 resource_id, | 2445 resource_id, |
2449 l10n_util::GetStringUTF16(message_id)); | 2446 l10n_util::GetStringUTF16(message_id)); |
2450 return blocked_plugin->plugin(); | 2447 return blocked_plugin->plugin(); |
(...skipping 3525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5976 } | 5973 } |
5977 | 5974 |
5978 void RenderView::OnAsyncFileOpened(base::PlatformFileError error_code, | 5975 void RenderView::OnAsyncFileOpened(base::PlatformFileError error_code, |
5979 IPC::PlatformFileForTransit file_for_transit, | 5976 IPC::PlatformFileForTransit file_for_transit, |
5980 int message_id) { | 5977 int message_id) { |
5981 pepper_delegate_.OnAsyncFileOpened( | 5978 pepper_delegate_.OnAsyncFileOpened( |
5982 error_code, | 5979 error_code, |
5983 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), | 5980 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), |
5984 message_id); | 5981 message_id); |
5985 } | 5982 } |
OLD | NEW |