Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Side by Side Diff: content/renderer/renderer_blink_platform_impl.cc

Issue 2024363002: Convert MimeRegistry to use mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@message-mojom-magic
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/common/service_registry.h ('k') | ipc/ipc_message_start.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 26 matching lines...) Expand all
37 #include "content/child/storage_util.h" 37 #include "content/child/storage_util.h"
38 #include "content/child/thread_safe_sender.h" 38 #include "content/child/thread_safe_sender.h"
39 #include "content/child/web_database_observer_impl.h" 39 #include "content/child/web_database_observer_impl.h"
40 #include "content/child/web_url_loader_impl.h" 40 #include "content/child/web_url_loader_impl.h"
41 #include "content/child/webfileutilities_impl.h" 41 #include "content/child/webfileutilities_impl.h"
42 #include "content/child/webmessageportchannel_impl.h" 42 #include "content/child/webmessageportchannel_impl.h"
43 #include "content/common/file_utilities_messages.h" 43 #include "content/common/file_utilities_messages.h"
44 #include "content/common/frame_messages.h" 44 #include "content/common/frame_messages.h"
45 #include "content/common/gpu/client/context_provider_command_buffer.h" 45 #include "content/common/gpu/client/context_provider_command_buffer.h"
46 #include "content/common/gpu_process_launch_causes.h" 46 #include "content/common/gpu_process_launch_causes.h"
47 #include "content/common/mime_registry_messages.h"
48 #include "content/common/render_process_messages.h" 47 #include "content/common/render_process_messages.h"
49 #include "content/public/common/content_switches.h" 48 #include "content/public/common/content_switches.h"
50 #include "content/public/common/service_registry.h" 49 #include "content/public/common/service_registry.h"
51 #include "content/public/common/webplugininfo.h" 50 #include "content/public/common/webplugininfo.h"
52 #include "content/public/renderer/content_renderer_client.h" 51 #include "content/public/renderer/content_renderer_client.h"
53 #include "content/public/renderer/media_stream_utils.h" 52 #include "content/public/renderer/media_stream_utils.h"
54 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" 53 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h"
55 #include "content/renderer/device_sensors/device_light_event_pump.h" 54 #include "content/renderer/device_sensors/device_light_event_pump.h"
56 #include "content/renderer/device_sensors/device_motion_event_pump.h" 55 #include "content/renderer/device_sensors/device_motion_event_pump.h"
57 #include "content/renderer/device_sensors/device_orientation_absolute_event_pump .h" 56 #include "content/renderer/device_sensors/device_orientation_absolute_event_pump .h"
(...skipping 21 matching lines...) Expand all
79 #include "gpu/command_buffer/client/gles2_interface.h" 78 #include "gpu/command_buffer/client/gles2_interface.h"
80 #include "gpu/config/gpu_info.h" 79 #include "gpu/config/gpu_info.h"
81 #include "gpu/ipc/client/gpu_channel_host.h" 80 #include "gpu/ipc/client/gpu_channel_host.h"
82 #include "gpu/ipc/common/gpu_stream_constants.h" 81 #include "gpu/ipc/common/gpu_stream_constants.h"
83 #include "ipc/ipc_sync_message_filter.h" 82 #include "ipc/ipc_sync_message_filter.h"
84 #include "media/audio/audio_output_device.h" 83 #include "media/audio/audio_output_device.h"
85 #include "media/base/audio_hardware_config.h" 84 #include "media/base/audio_hardware_config.h"
86 #include "media/base/mime_util.h" 85 #include "media/base/mime_util.h"
87 #include "media/blink/webcontentdecryptionmodule_impl.h" 86 #include "media/blink/webcontentdecryptionmodule_impl.h"
88 #include "media/filters/stream_parser_factory.h" 87 #include "media/filters/stream_parser_factory.h"
88 #include "mojo/common/common_type_converters.h"
89 #include "storage/common/database/database_identifier.h" 89 #include "storage/common/database/database_identifier.h"
90 #include "storage/common/quota/quota_types.h" 90 #include "storage/common/quota/quota_types.h"
91 #include "third_party/WebKit/public/platform/BlameContext.h" 91 #include "third_party/WebKit/public/platform/BlameContext.h"
92 #include "third_party/WebKit/public/platform/FilePathConversion.h" 92 #include "third_party/WebKit/public/platform/FilePathConversion.h"
93 #include "third_party/WebKit/public/platform/URLConversion.h" 93 #include "third_party/WebKit/public/platform/URLConversion.h"
94 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" 94 #include "third_party/WebKit/public/platform/WebBlobRegistry.h"
95 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" 95 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h"
96 #include "third_party/WebKit/public/platform/WebFileInfo.h" 96 #include "third_party/WebKit/public/platform/WebFileInfo.h"
97 #include "third_party/WebKit/public/platform/WebGamepads.h" 97 #include "third_party/WebKit/public/platform/WebGamepads.h"
98 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" 98 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h"
99 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" 99 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h"
100 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" 100 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h"
101 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 101 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
102 #include "third_party/WebKit/public/platform/WebURL.h" 102 #include "third_party/WebKit/public/platform/WebURL.h"
103 #include "third_party/WebKit/public/platform/WebVector.h" 103 #include "third_party/WebKit/public/platform/WebVector.h"
104 #include "third_party/WebKit/public/platform/mime_registry.mojom.h"
104 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionListener.h" 105 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionListener.h"
105 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationListener.h" 106 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationListener.h"
106 #include "ui/gfx/color_profile.h" 107 #include "ui/gfx/color_profile.h"
107 #include "url/gurl.h" 108 #include "url/gurl.h"
108 109
109 #if defined(OS_MACOSX) 110 #if defined(OS_MACOSX)
110 #include "content/common/mac/font_descriptor.h" 111 #include "content/common/mac/font_descriptor.h"
111 #include "content/common/mac/font_loader.h" 112 #include "content/common/mac/font_loader.h"
112 #include "content/renderer/webscrollbarbehavior_impl_mac.h" 113 #include "content/renderer/webscrollbarbehavior_impl_mac.h"
113 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" 114 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 class RendererBlinkPlatformImpl::MimeRegistry 188 class RendererBlinkPlatformImpl::MimeRegistry
188 : public SimpleWebMimeRegistryImpl { 189 : public SimpleWebMimeRegistryImpl {
189 public: 190 public:
190 blink::WebMimeRegistry::SupportsType supportsMediaMIMEType( 191 blink::WebMimeRegistry::SupportsType supportsMediaMIMEType(
191 const blink::WebString& mime_type, 192 const blink::WebString& mime_type,
192 const blink::WebString& codecs) override; 193 const blink::WebString& codecs) override;
193 bool supportsMediaSourceMIMEType(const blink::WebString& mime_type, 194 bool supportsMediaSourceMIMEType(const blink::WebString& mime_type,
194 const blink::WebString& codecs) override; 195 const blink::WebString& codecs) override;
195 blink::WebString mimeTypeForExtension( 196 blink::WebString mimeTypeForExtension(
196 const blink::WebString& file_extension) override; 197 const blink::WebString& file_extension) override;
198
199 private:
200 blink::mojom::MimeRegistryPtr mime_registry_;
197 }; 201 };
198 202
199 class RendererBlinkPlatformImpl::FileUtilities : public WebFileUtilitiesImpl { 203 class RendererBlinkPlatformImpl::FileUtilities : public WebFileUtilitiesImpl {
200 public: 204 public:
201 explicit FileUtilities(ThreadSafeSender* sender) 205 explicit FileUtilities(ThreadSafeSender* sender)
202 : thread_safe_sender_(sender) {} 206 : thread_safe_sender_(sender) {}
203 bool getFileInfo(const WebString& path, WebFileInfo& result) override; 207 bool getFileInfo(const WebString& path, WebFileInfo& result) override;
204 208
205 private: 209 private:
206 bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) const; 210 bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) const;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 if (mime_type_ascii.empty()) 510 if (mime_type_ascii.empty())
507 return false; 511 return false;
508 return media::StreamParserFactory::IsTypeSupported( 512 return media::StreamParserFactory::IsTypeSupported(
509 mime_type_ascii, parsed_codec_ids); 513 mime_type_ascii, parsed_codec_ids);
510 } 514 }
511 515
512 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension( 516 WebString RendererBlinkPlatformImpl::MimeRegistry::mimeTypeForExtension(
513 const WebString& file_extension) { 517 const WebString& file_extension) {
514 // The sandbox restricts our access to the registry, so we need to proxy 518 // The sandbox restricts our access to the registry, so we need to proxy
515 // these calls over to the browser process. 519 // these calls over to the browser process.
516 std::string mime_type; 520 if (!mime_registry_) {
517 RenderThread::Get()->Send( 521 RenderThread::Get()->GetServiceRegistry()->ConnectToRemoteService(
518 new MimeRegistryMsg_GetMimeTypeFromExtension( 522 mojo::GetProxy(&mime_registry_));
519 blink::WebStringToFilePath(file_extension).value(), &mime_type)); 523 }
520 return base::ASCIIToUTF16(mime_type); 524
525 mojo::String mime_type;
526 if (!mime_registry_->GetMimeTypeFromExtension(
527 mojo::String::From(base::string16(file_extension)), &mime_type)) {
528 return WebString();
529 }
530 return base::ASCIIToUTF16(mime_type.get());
521 } 531 }
522 532
523 //------------------------------------------------------------------------------ 533 //------------------------------------------------------------------------------
524 534
525 bool RendererBlinkPlatformImpl::FileUtilities::getFileInfo( 535 bool RendererBlinkPlatformImpl::FileUtilities::getFileInfo(
526 const WebString& path, 536 const WebString& path,
527 WebFileInfo& web_file_info) { 537 WebFileInfo& web_file_info) {
528 base::File::Info file_info; 538 base::File::Info file_info;
529 base::File::Error status = base::File::FILE_ERROR_MAX; 539 base::File::Error status = base::File::FILE_ERROR_MAX;
530 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo( 540 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo(
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 return &trial_token_validator_; 1335 return &trial_token_validator_;
1326 } 1336 }
1327 1337
1328 void RendererBlinkPlatformImpl::workerContextCreated( 1338 void RendererBlinkPlatformImpl::workerContextCreated(
1329 const v8::Local<v8::Context>& worker) { 1339 const v8::Local<v8::Context>& worker) {
1330 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( 1340 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread(
1331 worker); 1341 worker);
1332 } 1342 }
1333 1343
1334 } // namespace content 1344 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/service_registry.h ('k') | ipc/ipc_message_start.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698