OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/renderer_blink_platform_impl.h" | 5 #include "content/renderer/renderer_blink_platform_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "components/url_formatter/url_formatter.h" | 24 #include "components/url_formatter/url_formatter.h" |
25 #include "content/child/blob_storage/webblobregistry_impl.h" | 25 #include "content/child/blob_storage/webblobregistry_impl.h" |
26 #include "content/child/child_gpu_memory_buffer_manager.h" | 26 #include "content/child/child_gpu_memory_buffer_manager.h" |
27 #include "content/child/child_shared_bitmap_manager.h" | 27 #include "content/child/child_shared_bitmap_manager.h" |
28 #include "content/child/database_util.h" | 28 #include "content/child/database_util.h" |
29 #include "content/child/file_info_util.h" | 29 #include "content/child/file_info_util.h" |
30 #include "content/child/fileapi/webfilesystem_impl.h" | 30 #include "content/child/fileapi/webfilesystem_impl.h" |
31 #include "content/child/indexed_db/webidbfactory_impl.h" | 31 #include "content/child/indexed_db/webidbfactory_impl.h" |
32 #include "content/child/quota_dispatcher.h" | 32 #include "content/child/quota_dispatcher.h" |
33 #include "content/child/quota_message_filter.h" | 33 #include "content/child/quota_message_filter.h" |
34 #include "content/child/simple_webmimeregistry_impl.h" | |
35 #include "content/child/storage_util.h" | 34 #include "content/child/storage_util.h" |
36 #include "content/child/thread_safe_sender.h" | 35 #include "content/child/thread_safe_sender.h" |
37 #include "content/child/web_database_observer_impl.h" | 36 #include "content/child/web_database_observer_impl.h" |
38 #include "content/child/web_url_loader_impl.h" | 37 #include "content/child/web_url_loader_impl.h" |
39 #include "content/child/webfileutilities_impl.h" | 38 #include "content/child/webfileutilities_impl.h" |
40 #include "content/child/webmessageportchannel_impl.h" | 39 #include "content/child/webmessageportchannel_impl.h" |
41 #include "content/common/file_utilities_messages.h" | 40 #include "content/common/file_utilities_messages.h" |
42 #include "content/common/frame_messages.h" | 41 #include "content/common/frame_messages.h" |
43 #include "content/common/gpu/client/context_provider_command_buffer.h" | 42 #include "content/common/gpu/client/context_provider_command_buffer.h" |
44 #include "content/common/render_process_messages.h" | 43 #include "content/common/render_process_messages.h" |
(...skipping 25 matching lines...) Expand all Loading... |
70 #include "content/renderer/screen_orientation/screen_orientation_observer.h" | 69 #include "content/renderer/screen_orientation/screen_orientation_observer.h" |
71 #include "content/renderer/webclipboard_impl.h" | 70 #include "content/renderer/webclipboard_impl.h" |
72 #include "content/renderer/webgraphicscontext3d_provider_impl.h" | 71 #include "content/renderer/webgraphicscontext3d_provider_impl.h" |
73 #include "content/renderer/webpublicsuffixlist_impl.h" | 72 #include "content/renderer/webpublicsuffixlist_impl.h" |
74 #include "gpu/command_buffer/client/gles2_interface.h" | 73 #include "gpu/command_buffer/client/gles2_interface.h" |
75 #include "gpu/config/gpu_info.h" | 74 #include "gpu/config/gpu_info.h" |
76 #include "gpu/ipc/client/gpu_channel_host.h" | 75 #include "gpu/ipc/client/gpu_channel_host.h" |
77 #include "gpu/ipc/common/gpu_stream_constants.h" | 76 #include "gpu/ipc/common/gpu_stream_constants.h" |
78 #include "ipc/ipc_sync_message_filter.h" | 77 #include "ipc/ipc_sync_message_filter.h" |
79 #include "media/audio/audio_output_device.h" | 78 #include "media/audio/audio_output_device.h" |
80 #include "media/base/mime_util.h" | |
81 #include "media/blink/webcontentdecryptionmodule_impl.h" | 79 #include "media/blink/webcontentdecryptionmodule_impl.h" |
82 #include "media/filters/stream_parser_factory.h" | 80 #include "media/filters/stream_parser_factory.h" |
83 #include "mojo/common/common_type_converters.h" | 81 #include "mojo/common/common_type_converters.h" |
84 #include "mojo/public/cpp/bindings/associated_group.h" | 82 #include "mojo/public/cpp/bindings/associated_group.h" |
85 #include "services/service_manager/public/cpp/interface_provider.h" | 83 #include "services/service_manager/public/cpp/interface_provider.h" |
86 #include "storage/common/database/database_identifier.h" | 84 #include "storage/common/database/database_identifier.h" |
87 #include "storage/common/quota/quota_types.h" | 85 #include "storage/common/quota/quota_types.h" |
88 #include "third_party/WebKit/public/platform/BlameContext.h" | 86 #include "third_party/WebKit/public/platform/BlameContext.h" |
89 #include "third_party/WebKit/public/platform/FilePathConversion.h" | 87 #include "third_party/WebKit/public/platform/FilePathConversion.h" |
90 #include "third_party/WebKit/public/platform/URLConversion.h" | 88 #include "third_party/WebKit/public/platform/URLConversion.h" |
91 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" | 89 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" |
92 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" | 90 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" |
93 #include "third_party/WebKit/public/platform/WebFileInfo.h" | 91 #include "third_party/WebKit/public/platform/WebFileInfo.h" |
94 #include "third_party/WebKit/public/platform/WebGamepads.h" | 92 #include "third_party/WebKit/public/platform/WebGamepads.h" |
95 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 93 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
96 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 94 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" |
97 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 95 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" |
98 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 96 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
99 #include "third_party/WebKit/public/platform/WebURL.h" | 97 #include "third_party/WebKit/public/platform/WebURL.h" |
100 #include "third_party/WebKit/public/platform/WebVector.h" | 98 #include "third_party/WebKit/public/platform/WebVector.h" |
101 #include "third_party/WebKit/public/platform/mime_registry.mojom.h" | |
102 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eMotionListener.h" | 99 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eMotionListener.h" |
103 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eOrientationListener.h" | 100 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eOrientationListener.h" |
104 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 101 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
105 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 102 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
106 #include "url/gurl.h" | 103 #include "url/gurl.h" |
107 | 104 |
108 #if defined(OS_MACOSX) | 105 #if defined(OS_MACOSX) |
109 #include "content/common/mac/font_descriptor.h" | 106 #include "content/common/mac/font_descriptor.h" |
110 #include "content/common/mac/font_loader.h" | 107 #include "content/common/mac/font_loader.h" |
111 #include "content/renderer/webscrollbarbehavior_impl_mac.h" | 108 #include "content/renderer/webscrollbarbehavior_impl_mac.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 using blink::WebGamepads; | 150 using blink::WebGamepads; |
154 using blink::WebIDBFactory; | 151 using blink::WebIDBFactory; |
155 using blink::WebImageCaptureFrameGrabber; | 152 using blink::WebImageCaptureFrameGrabber; |
156 using blink::WebMIDIAccessor; | 153 using blink::WebMIDIAccessor; |
157 using blink::WebMediaPlayer; | 154 using blink::WebMediaPlayer; |
158 using blink::WebMediaRecorderHandler; | 155 using blink::WebMediaRecorderHandler; |
159 using blink::WebMediaStream; | 156 using blink::WebMediaStream; |
160 using blink::WebMediaStreamCenter; | 157 using blink::WebMediaStreamCenter; |
161 using blink::WebMediaStreamCenterClient; | 158 using blink::WebMediaStreamCenterClient; |
162 using blink::WebMediaStreamTrack; | 159 using blink::WebMediaStreamTrack; |
163 using blink::WebMimeRegistry; | |
164 using blink::WebRTCPeerConnectionHandler; | 160 using blink::WebRTCPeerConnectionHandler; |
165 using blink::WebRTCPeerConnectionHandlerClient; | 161 using blink::WebRTCPeerConnectionHandlerClient; |
166 using blink::WebStorageNamespace; | 162 using blink::WebStorageNamespace; |
167 using blink::WebSize; | 163 using blink::WebSize; |
168 using blink::WebString; | 164 using blink::WebString; |
169 using blink::WebURL; | 165 using blink::WebURL; |
170 using blink::WebVector; | 166 using blink::WebVector; |
171 | 167 |
172 namespace content { | 168 namespace content { |
173 | 169 |
(...skipping 13 matching lines...) Expand all Loading... |
187 return AudioDeviceFactory::GetOutputDeviceInfo(render_frame->GetRoutingID(), | 183 return AudioDeviceFactory::GetOutputDeviceInfo(render_frame->GetRoutingID(), |
188 0, std::string(), | 184 0, std::string(), |
189 web_frame->getSecurityOrigin()) | 185 web_frame->getSecurityOrigin()) |
190 .output_params(); | 186 .output_params(); |
191 } | 187 } |
192 | 188 |
193 } // namespace | 189 } // namespace |
194 | 190 |
195 //------------------------------------------------------------------------------ | 191 //------------------------------------------------------------------------------ |
196 | 192 |
197 class RendererBlinkPlatformImpl::MimeRegistry | |
198 : public SimpleWebMimeRegistryImpl { | |
199 public: | |
200 blink::WebString mimeTypeForExtension( | |
201 const blink::WebString& file_extension) override; | |
202 | |
203 private: | |
204 blink::mojom::MimeRegistryPtr mime_registry_; | |
205 }; | |
206 | |
207 class RendererBlinkPlatformImpl::FileUtilities : public WebFileUtilitiesImpl { | 193 class RendererBlinkPlatformImpl::FileUtilities : public WebFileUtilitiesImpl { |
208 public: | 194 public: |
209 explicit FileUtilities(ThreadSafeSender* sender) | 195 explicit FileUtilities(ThreadSafeSender* sender) |
210 : thread_safe_sender_(sender) {} | 196 : thread_safe_sender_(sender) {} |
211 bool getFileInfo(const WebString& path, WebFileInfo& result) override; | 197 bool getFileInfo(const WebString& path, WebFileInfo& result) override; |
212 | 198 |
213 private: | 199 private: |
214 bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) const; | 200 bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) const; |
215 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 201 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
216 }; | 202 }; |
(...skipping 29 matching lines...) Expand all Loading... |
246 | 232 |
247 //------------------------------------------------------------------------------ | 233 //------------------------------------------------------------------------------ |
248 | 234 |
249 RendererBlinkPlatformImpl::RendererBlinkPlatformImpl( | 235 RendererBlinkPlatformImpl::RendererBlinkPlatformImpl( |
250 blink::scheduler::RendererScheduler* renderer_scheduler, | 236 blink::scheduler::RendererScheduler* renderer_scheduler, |
251 base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces) | 237 base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces) |
252 : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()), | 238 : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()), |
253 main_thread_(renderer_scheduler->CreateMainThread()), | 239 main_thread_(renderer_scheduler->CreateMainThread()), |
254 clipboard_delegate_(new RendererClipboardDelegate), | 240 clipboard_delegate_(new RendererClipboardDelegate), |
255 clipboard_(new WebClipboardImpl(clipboard_delegate_.get())), | 241 clipboard_(new WebClipboardImpl(clipboard_delegate_.get())), |
256 mime_registry_(new RendererBlinkPlatformImpl::MimeRegistry), | |
257 sudden_termination_disables_(0), | 242 sudden_termination_disables_(0), |
258 plugin_refresh_allowed_(true), | 243 plugin_refresh_allowed_(true), |
259 default_task_runner_(renderer_scheduler->DefaultTaskRunner()), | 244 default_task_runner_(renderer_scheduler->DefaultTaskRunner()), |
260 loading_task_runner_(renderer_scheduler->LoadingTaskRunner()), | 245 loading_task_runner_(renderer_scheduler->LoadingTaskRunner()), |
261 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl), | 246 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl), |
262 renderer_scheduler_(renderer_scheduler), | 247 renderer_scheduler_(renderer_scheduler), |
263 blink_interface_provider_( | 248 blink_interface_provider_( |
264 new BlinkInterfaceProviderImpl(remote_interfaces)) { | 249 new BlinkInterfaceProviderImpl(remote_interfaces)) { |
265 #if !defined(OS_ANDROID) && !defined(OS_WIN) | 250 #if !defined(OS_ANDROID) && !defined(OS_WIN) |
266 if (g_sandbox_enabled && sandboxEnabled()) { | 251 if (g_sandbox_enabled && sandboxEnabled()) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } | 315 } |
331 | 316 |
332 blink::WebClipboard* RendererBlinkPlatformImpl::clipboard() { | 317 blink::WebClipboard* RendererBlinkPlatformImpl::clipboard() { |
333 blink::WebClipboard* clipboard = | 318 blink::WebClipboard* clipboard = |
334 GetContentClient()->renderer()->OverrideWebClipboard(); | 319 GetContentClient()->renderer()->OverrideWebClipboard(); |
335 if (clipboard) | 320 if (clipboard) |
336 return clipboard; | 321 return clipboard; |
337 return clipboard_.get(); | 322 return clipboard_.get(); |
338 } | 323 } |
339 | 324 |
340 blink::WebMimeRegistry* RendererBlinkPlatformImpl::mimeRegistry() { | |
341 return mime_registry_.get(); | |
342 } | |
343 | |
344 blink::WebFileUtilities* RendererBlinkPlatformImpl::fileUtilities() { | 325 blink::WebFileUtilities* RendererBlinkPlatformImpl::fileUtilities() { |
345 if (!file_utilities_) { | 326 if (!file_utilities_) { |
346 file_utilities_.reset(new FileUtilities(thread_safe_sender_.get())); | 327 file_utilities_.reset(new FileUtilities(thread_safe_sender_.get())); |
347 file_utilities_->set_sandbox_enabled(sandboxEnabled()); | 328 file_utilities_->set_sandbox_enabled(sandboxEnabled()); |
348 } | 329 } |
349 return file_utilities_.get(); | 330 return file_utilities_.get(); |
350 } | 331 } |
351 | 332 |
352 blink::WebSandboxSupport* RendererBlinkPlatformImpl::sandboxSupport() { | 333 blink::WebSandboxSupport* RendererBlinkPlatformImpl::sandboxSupport() { |
353 #if defined(OS_ANDROID) || defined(OS_WIN) | 334 #if defined(OS_ANDROID) || defined(OS_WIN) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 } | 475 } |
495 | 476 |
496 WebString RendererBlinkPlatformImpl::fileSystemCreateOriginIdentifier( | 477 WebString RendererBlinkPlatformImpl::fileSystemCreateOriginIdentifier( |
497 const blink::WebSecurityOrigin& origin) { | 478 const blink::WebSecurityOrigin& origin) { |
498 return WebString::fromUTF8(storage::GetIdentifierFromOrigin( | 479 return WebString::fromUTF8(storage::GetIdentifierFromOrigin( |
499 WebSecurityOriginToGURL(origin))); | 480 WebSecurityOriginToGURL(origin))); |
500 } | 481 } |
501 | 482 |
502 //------------------------------------------------------------------------------ | 483 //------------------------------------------------------------------------------ |
503 | 484 |
504 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension( | |
505 const WebString& file_extension) { | |
506 // The sandbox restricts our access to the registry, so we need to proxy | |
507 // these calls over to the browser process. | |
508 if (!mime_registry_) | |
509 RenderThread::Get()->GetRemoteInterfaces()->GetInterface(&mime_registry_); | |
510 | |
511 mojo::String mime_type; | |
512 if (!mime_registry_->GetMimeTypeFromExtension( | |
513 mojo::String::From(base::string16(file_extension)), &mime_type)) { | |
514 return WebString(); | |
515 } | |
516 return WebString::fromASCII(mime_type.get()); | |
517 } | |
518 | |
519 //------------------------------------------------------------------------------ | |
520 | |
521 bool RendererBlinkPlatformImpl::FileUtilities::getFileInfo( | 485 bool RendererBlinkPlatformImpl::FileUtilities::getFileInfo( |
522 const WebString& path, | 486 const WebString& path, |
523 WebFileInfo& web_file_info) { | 487 WebFileInfo& web_file_info) { |
524 base::File::Info file_info; | 488 base::File::Info file_info; |
525 base::File::Error status = base::File::FILE_ERROR_MAX; | 489 base::File::Error status = base::File::FILE_ERROR_MAX; |
526 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo( | 490 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo( |
527 blink::WebStringToFilePath(path), &file_info, &status)) || | 491 blink::WebStringToFilePath(path), &file_info, &status)) || |
528 status != base::File::FILE_OK) { | 492 status != base::File::FILE_OK) { |
529 return false; | 493 return false; |
530 } | 494 } |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 return &trial_token_validator_; | 1290 return &trial_token_validator_; |
1327 } | 1291 } |
1328 | 1292 |
1329 void RendererBlinkPlatformImpl::workerContextCreated( | 1293 void RendererBlinkPlatformImpl::workerContextCreated( |
1330 const v8::Local<v8::Context>& worker) { | 1294 const v8::Local<v8::Context>& worker) { |
1331 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( | 1295 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( |
1332 worker); | 1296 worker); |
1333 } | 1297 } |
1334 | 1298 |
1335 } // namespace content | 1299 } // namespace content |
OLD | NEW |