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 "services/service_manager/public/cpp/interface_provider.h" | 82 #include "services/service_manager/public/cpp/interface_provider.h" |
85 #include "storage/common/database/database_identifier.h" | 83 #include "storage/common/database/database_identifier.h" |
86 #include "storage/common/quota/quota_types.h" | 84 #include "storage/common/quota/quota_types.h" |
87 #include "third_party/WebKit/public/platform/BlameContext.h" | 85 #include "third_party/WebKit/public/platform/BlameContext.h" |
88 #include "third_party/WebKit/public/platform/FilePathConversion.h" | 86 #include "third_party/WebKit/public/platform/FilePathConversion.h" |
89 #include "third_party/WebKit/public/platform/URLConversion.h" | 87 #include "third_party/WebKit/public/platform/URLConversion.h" |
90 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" | 88 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" |
91 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" | 89 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" |
92 #include "third_party/WebKit/public/platform/WebFileInfo.h" | 90 #include "third_party/WebKit/public/platform/WebFileInfo.h" |
93 #include "third_party/WebKit/public/platform/WebGamepads.h" | 91 #include "third_party/WebKit/public/platform/WebGamepads.h" |
94 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 92 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
95 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 93 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" |
96 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 94 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" |
97 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 95 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
98 #include "third_party/WebKit/public/platform/WebURL.h" | 96 #include "third_party/WebKit/public/platform/WebURL.h" |
99 #include "third_party/WebKit/public/platform/WebVector.h" | 97 #include "third_party/WebKit/public/platform/WebVector.h" |
100 #include "third_party/WebKit/public/platform/mime_registry.mojom.h" | |
101 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eMotionListener.h" | 98 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eMotionListener.h" |
102 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eOrientationListener.h" | 99 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eOrientationListener.h" |
103 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 100 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
104 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 101 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
105 #include "url/gurl.h" | 102 #include "url/gurl.h" |
106 | 103 |
107 #if defined(OS_MACOSX) | 104 #if defined(OS_MACOSX) |
108 #include "content/common/mac/font_descriptor.h" | 105 #include "content/common/mac/font_descriptor.h" |
109 #include "content/common/mac/font_loader.h" | 106 #include "content/common/mac/font_loader.h" |
110 #include "content/renderer/webscrollbarbehavior_impl_mac.h" | 107 #include "content/renderer/webscrollbarbehavior_impl_mac.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 using blink::WebGamepads; | 149 using blink::WebGamepads; |
153 using blink::WebIDBFactory; | 150 using blink::WebIDBFactory; |
154 using blink::WebImageCaptureFrameGrabber; | 151 using blink::WebImageCaptureFrameGrabber; |
155 using blink::WebMIDIAccessor; | 152 using blink::WebMIDIAccessor; |
156 using blink::WebMediaPlayer; | 153 using blink::WebMediaPlayer; |
157 using blink::WebMediaRecorderHandler; | 154 using blink::WebMediaRecorderHandler; |
158 using blink::WebMediaStream; | 155 using blink::WebMediaStream; |
159 using blink::WebMediaStreamCenter; | 156 using blink::WebMediaStreamCenter; |
160 using blink::WebMediaStreamCenterClient; | 157 using blink::WebMediaStreamCenterClient; |
161 using blink::WebMediaStreamTrack; | 158 using blink::WebMediaStreamTrack; |
162 using blink::WebMimeRegistry; | |
163 using blink::WebRTCPeerConnectionHandler; | 159 using blink::WebRTCPeerConnectionHandler; |
164 using blink::WebRTCPeerConnectionHandlerClient; | 160 using blink::WebRTCPeerConnectionHandlerClient; |
165 using blink::WebStorageNamespace; | 161 using blink::WebStorageNamespace; |
166 using blink::WebSize; | 162 using blink::WebSize; |
167 using blink::WebString; | 163 using blink::WebString; |
168 using blink::WebURL; | 164 using blink::WebURL; |
169 using blink::WebVector; | 165 using blink::WebVector; |
170 | 166 |
171 namespace content { | 167 namespace content { |
172 | 168 |
(...skipping 13 matching lines...) Expand all Loading... |
186 return AudioDeviceFactory::GetOutputDeviceInfo(render_frame->GetRoutingID(), | 182 return AudioDeviceFactory::GetOutputDeviceInfo(render_frame->GetRoutingID(), |
187 0, std::string(), | 183 0, std::string(), |
188 web_frame->getSecurityOrigin()) | 184 web_frame->getSecurityOrigin()) |
189 .output_params(); | 185 .output_params(); |
190 } | 186 } |
191 | 187 |
192 } // namespace | 188 } // namespace |
193 | 189 |
194 //------------------------------------------------------------------------------ | 190 //------------------------------------------------------------------------------ |
195 | 191 |
196 class RendererBlinkPlatformImpl::MimeRegistry | |
197 : public SimpleWebMimeRegistryImpl { | |
198 public: | |
199 blink::WebString mimeTypeForExtension( | |
200 const blink::WebString& file_extension) override; | |
201 | |
202 private: | |
203 blink::mojom::MimeRegistryPtr mime_registry_; | |
204 }; | |
205 | |
206 class RendererBlinkPlatformImpl::FileUtilities : public WebFileUtilitiesImpl { | 192 class RendererBlinkPlatformImpl::FileUtilities : public WebFileUtilitiesImpl { |
207 public: | 193 public: |
208 explicit FileUtilities(ThreadSafeSender* sender) | 194 explicit FileUtilities(ThreadSafeSender* sender) |
209 : thread_safe_sender_(sender) {} | 195 : thread_safe_sender_(sender) {} |
210 bool getFileInfo(const WebString& path, WebFileInfo& result) override; | 196 bool getFileInfo(const WebString& path, WebFileInfo& result) override; |
211 | 197 |
212 private: | 198 private: |
213 bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) const; | 199 bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) const; |
214 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 200 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
215 }; | 201 }; |
(...skipping 29 matching lines...) Expand all Loading... |
245 | 231 |
246 //------------------------------------------------------------------------------ | 232 //------------------------------------------------------------------------------ |
247 | 233 |
248 RendererBlinkPlatformImpl::RendererBlinkPlatformImpl( | 234 RendererBlinkPlatformImpl::RendererBlinkPlatformImpl( |
249 blink::scheduler::RendererScheduler* renderer_scheduler, | 235 blink::scheduler::RendererScheduler* renderer_scheduler, |
250 base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces) | 236 base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces) |
251 : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()), | 237 : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()), |
252 main_thread_(renderer_scheduler->CreateMainThread()), | 238 main_thread_(renderer_scheduler->CreateMainThread()), |
253 clipboard_delegate_(new RendererClipboardDelegate), | 239 clipboard_delegate_(new RendererClipboardDelegate), |
254 clipboard_(new WebClipboardImpl(clipboard_delegate_.get())), | 240 clipboard_(new WebClipboardImpl(clipboard_delegate_.get())), |
255 mime_registry_(new RendererBlinkPlatformImpl::MimeRegistry), | |
256 sudden_termination_disables_(0), | 241 sudden_termination_disables_(0), |
257 plugin_refresh_allowed_(true), | 242 plugin_refresh_allowed_(true), |
258 default_task_runner_(renderer_scheduler->DefaultTaskRunner()), | 243 default_task_runner_(renderer_scheduler->DefaultTaskRunner()), |
259 loading_task_runner_(renderer_scheduler->LoadingTaskRunner()), | 244 loading_task_runner_(renderer_scheduler->LoadingTaskRunner()), |
260 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl), | 245 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl), |
261 renderer_scheduler_(renderer_scheduler), | 246 renderer_scheduler_(renderer_scheduler), |
262 blink_interface_provider_( | 247 blink_interface_provider_( |
263 new BlinkInterfaceProviderImpl(remote_interfaces)) { | 248 new BlinkInterfaceProviderImpl(remote_interfaces)) { |
264 #if !defined(OS_ANDROID) && !defined(OS_WIN) | 249 #if !defined(OS_ANDROID) && !defined(OS_WIN) |
265 if (g_sandbox_enabled && sandboxEnabled()) { | 250 if (g_sandbox_enabled && sandboxEnabled()) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 314 } |
330 | 315 |
331 blink::WebClipboard* RendererBlinkPlatformImpl::clipboard() { | 316 blink::WebClipboard* RendererBlinkPlatformImpl::clipboard() { |
332 blink::WebClipboard* clipboard = | 317 blink::WebClipboard* clipboard = |
333 GetContentClient()->renderer()->OverrideWebClipboard(); | 318 GetContentClient()->renderer()->OverrideWebClipboard(); |
334 if (clipboard) | 319 if (clipboard) |
335 return clipboard; | 320 return clipboard; |
336 return clipboard_.get(); | 321 return clipboard_.get(); |
337 } | 322 } |
338 | 323 |
339 blink::WebMimeRegistry* RendererBlinkPlatformImpl::mimeRegistry() { | |
340 return mime_registry_.get(); | |
341 } | |
342 | |
343 blink::WebFileUtilities* RendererBlinkPlatformImpl::fileUtilities() { | 324 blink::WebFileUtilities* RendererBlinkPlatformImpl::fileUtilities() { |
344 if (!file_utilities_) { | 325 if (!file_utilities_) { |
345 file_utilities_.reset(new FileUtilities(thread_safe_sender_.get())); | 326 file_utilities_.reset(new FileUtilities(thread_safe_sender_.get())); |
346 file_utilities_->set_sandbox_enabled(sandboxEnabled()); | 327 file_utilities_->set_sandbox_enabled(sandboxEnabled()); |
347 } | 328 } |
348 return file_utilities_.get(); | 329 return file_utilities_.get(); |
349 } | 330 } |
350 | 331 |
351 blink::WebSandboxSupport* RendererBlinkPlatformImpl::sandboxSupport() { | 332 blink::WebSandboxSupport* RendererBlinkPlatformImpl::sandboxSupport() { |
352 #if defined(OS_ANDROID) || defined(OS_WIN) | 333 #if defined(OS_ANDROID) || defined(OS_WIN) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 } | 474 } |
494 | 475 |
495 WebString RendererBlinkPlatformImpl::fileSystemCreateOriginIdentifier( | 476 WebString RendererBlinkPlatformImpl::fileSystemCreateOriginIdentifier( |
496 const blink::WebSecurityOrigin& origin) { | 477 const blink::WebSecurityOrigin& origin) { |
497 return WebString::fromUTF8(storage::GetIdentifierFromOrigin( | 478 return WebString::fromUTF8(storage::GetIdentifierFromOrigin( |
498 WebSecurityOriginToGURL(origin))); | 479 WebSecurityOriginToGURL(origin))); |
499 } | 480 } |
500 | 481 |
501 //------------------------------------------------------------------------------ | 482 //------------------------------------------------------------------------------ |
502 | 483 |
503 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension( | |
504 const WebString& file_extension) { | |
505 // The sandbox restricts our access to the registry, so we need to proxy | |
506 // these calls over to the browser process. | |
507 if (!mime_registry_) | |
508 RenderThread::Get()->GetRemoteInterfaces()->GetInterface(&mime_registry_); | |
509 | |
510 mojo::String mime_type; | |
511 if (!mime_registry_->GetMimeTypeFromExtension( | |
512 mojo::String::From(base::string16(file_extension)), &mime_type)) { | |
513 return WebString(); | |
514 } | |
515 return base::ASCIIToUTF16(mime_type.get()); | |
516 } | |
517 | |
518 //------------------------------------------------------------------------------ | |
519 | |
520 bool RendererBlinkPlatformImpl::FileUtilities::getFileInfo( | 484 bool RendererBlinkPlatformImpl::FileUtilities::getFileInfo( |
521 const WebString& path, | 485 const WebString& path, |
522 WebFileInfo& web_file_info) { | 486 WebFileInfo& web_file_info) { |
523 base::File::Info file_info; | 487 base::File::Info file_info; |
524 base::File::Error status = base::File::FILE_ERROR_MAX; | 488 base::File::Error status = base::File::FILE_ERROR_MAX; |
525 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo( | 489 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo( |
526 blink::WebStringToFilePath(path), &file_info, &status)) || | 490 blink::WebStringToFilePath(path), &file_info, &status)) || |
527 status != base::File::FILE_OK) { | 491 status != base::File::FILE_OK) { |
528 return false; | 492 return false; |
529 } | 493 } |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 return &trial_token_validator_; | 1289 return &trial_token_validator_; |
1326 } | 1290 } |
1327 | 1291 |
1328 void RendererBlinkPlatformImpl::workerContextCreated( | 1292 void RendererBlinkPlatformImpl::workerContextCreated( |
1329 const v8::Local<v8::Context>& worker) { | 1293 const v8::Local<v8::Context>& worker) { |
1330 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( | 1294 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( |
1331 worker); | 1295 worker); |
1332 } | 1296 } |
1333 | 1297 |
1334 } // namespace content | 1298 } // namespace content |
OLD | NEW |