| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 .output_params(); | 189 .output_params(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace | 192 } // namespace |
| 193 | 193 |
| 194 //------------------------------------------------------------------------------ | 194 //------------------------------------------------------------------------------ |
| 195 | 195 |
| 196 class RendererBlinkPlatformImpl::MimeRegistry | 196 class RendererBlinkPlatformImpl::MimeRegistry |
| 197 : public SimpleWebMimeRegistryImpl { | 197 : public SimpleWebMimeRegistryImpl { |
| 198 public: | 198 public: |
| 199 blink::WebMimeRegistry::SupportsType supportsMediaMIMEType( | |
| 200 const blink::WebString& mime_type, | |
| 201 const blink::WebString& codecs) override; | |
| 202 bool supportsMediaSourceMIMEType(const blink::WebString& mime_type, | |
| 203 const blink::WebString& codecs) override; | |
| 204 blink::WebString mimeTypeForExtension( | 199 blink::WebString mimeTypeForExtension( |
| 205 const blink::WebString& file_extension) override; | 200 const blink::WebString& file_extension) override; |
| 206 | 201 |
| 207 private: | 202 private: |
| 208 blink::mojom::MimeRegistryPtr mime_registry_; | 203 blink::mojom::MimeRegistryPtr mime_registry_; |
| 209 }; | 204 }; |
| 210 | 205 |
| 211 class RendererBlinkPlatformImpl::FileUtilities : public WebFileUtilitiesImpl { | 206 class RendererBlinkPlatformImpl::FileUtilities : public WebFileUtilitiesImpl { |
| 212 public: | 207 public: |
| 213 explicit FileUtilities(ThreadSafeSender* sender) | 208 explicit FileUtilities(ThreadSafeSender* sender) |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 491 } |
| 497 | 492 |
| 498 WebString RendererBlinkPlatformImpl::fileSystemCreateOriginIdentifier( | 493 WebString RendererBlinkPlatformImpl::fileSystemCreateOriginIdentifier( |
| 499 const blink::WebSecurityOrigin& origin) { | 494 const blink::WebSecurityOrigin& origin) { |
| 500 return WebString::fromUTF8(storage::GetIdentifierFromOrigin( | 495 return WebString::fromUTF8(storage::GetIdentifierFromOrigin( |
| 501 WebSecurityOriginToGURL(origin))); | 496 WebSecurityOriginToGURL(origin))); |
| 502 } | 497 } |
| 503 | 498 |
| 504 //------------------------------------------------------------------------------ | 499 //------------------------------------------------------------------------------ |
| 505 | 500 |
| 506 WebMimeRegistry::SupportsType | |
| 507 RendererBlinkPlatformImpl::MimeRegistry::supportsMediaMIMEType( | |
| 508 const WebString& mime_type, | |
| 509 const WebString& codecs) { | |
| 510 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); | |
| 511 | |
| 512 std::vector<std::string> codec_vector; | |
| 513 media::ParseCodecString(ToASCIIOrEmpty(codecs), &codec_vector, false); | |
| 514 return static_cast<WebMimeRegistry::SupportsType>( | |
| 515 media::IsSupportedMediaFormat(mime_type_ascii, codec_vector)); | |
| 516 } | |
| 517 | |
| 518 bool RendererBlinkPlatformImpl::MimeRegistry::supportsMediaSourceMIMEType( | |
| 519 const blink::WebString& mime_type, | |
| 520 const WebString& codecs) { | |
| 521 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); | |
| 522 std::vector<std::string> parsed_codec_ids; | |
| 523 media::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codec_ids, false); | |
| 524 if (mime_type_ascii.empty()) | |
| 525 return false; | |
| 526 return media::StreamParserFactory::IsTypeSupported( | |
| 527 mime_type_ascii, parsed_codec_ids); | |
| 528 } | |
| 529 | |
| 530 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension( | 501 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension( |
| 531 const WebString& file_extension) { | 502 const WebString& file_extension) { |
| 532 // The sandbox restricts our access to the registry, so we need to proxy | 503 // The sandbox restricts our access to the registry, so we need to proxy |
| 533 // these calls over to the browser process. | 504 // these calls over to the browser process. |
| 534 if (!mime_registry_) | 505 if (!mime_registry_) |
| 535 RenderThread::Get()->GetRemoteInterfaces()->GetInterface(&mime_registry_); | 506 RenderThread::Get()->GetRemoteInterfaces()->GetInterface(&mime_registry_); |
| 536 | 507 |
| 537 mojo::String mime_type; | 508 mojo::String mime_type; |
| 538 if (!mime_registry_->GetMimeTypeFromExtension( | 509 if (!mime_registry_->GetMimeTypeFromExtension( |
| 539 mojo::String::From(base::string16(file_extension)), &mime_type)) { | 510 mojo::String::From(base::string16(file_extension)), &mime_type)) { |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 return &trial_token_validator_; | 1323 return &trial_token_validator_; |
| 1353 } | 1324 } |
| 1354 | 1325 |
| 1355 void RendererBlinkPlatformImpl::workerContextCreated( | 1326 void RendererBlinkPlatformImpl::workerContextCreated( |
| 1356 const v8::Local<v8::Context>& worker) { | 1327 const v8::Local<v8::Context>& worker) { |
| 1357 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( | 1328 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( |
| 1358 worker); | 1329 worker); |
| 1359 } | 1330 } |
| 1360 | 1331 |
| 1361 } // namespace content | 1332 } // namespace content |
| OLD | NEW |