| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/pepper/resource_converter.h" | 5 #include "content/renderer/pepper/resource_converter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "content/public/renderer/renderer_ppapi_host.h" | 9 #include "content/public/renderer/renderer_ppapi_host.h" |
| 10 #include "content/renderer/pepper/pepper_file_system_host.h" | 10 #include "content/renderer/pepper/pepper_file_system_host.h" |
| 11 #include "content/renderer/pepper/pepper_media_stream_audio_track_host.h" | 11 #include "content/renderer/pepper/pepper_media_stream_audio_track_host.h" |
| 12 #include "content/renderer/pepper/pepper_media_stream_video_track_host.h" | 12 #include "content/renderer/pepper/pepper_media_stream_video_track_host.h" |
| 13 #include "ipc/ipc_message.h" | 13 #include "ipc/ipc_message.h" |
| 14 #include "ppapi/host/ppapi_host.h" | 14 #include "ppapi/host/ppapi_host.h" |
| 15 #include "ppapi/host/resource_host.h" | 15 #include "ppapi/host/resource_host.h" |
| 16 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
| 17 #include "ppapi/shared_impl/resource_var.h" | 17 #include "ppapi/shared_impl/resource_var.h" |
| 18 #include "ppapi/shared_impl/scoped_pp_var.h" | 18 #include "ppapi/shared_impl/scoped_pp_var.h" |
| 19 #include "third_party/WebKit/public/platform/WebFileSystem.h" | 19 #include "third_party/WebKit/public/platform/WebFileSystem.h" |
| 20 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 20 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| 21 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 21 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 22 #include "third_party/WebKit/public/web/WebDOMFileSystem.h" | 22 #include "third_party/WebKit/public/web/WebDOMFileSystem.h" |
| 23 #include "third_party/WebKit/public/web/WebDOMMediaStreamTrack.h" | 23 #include "third_party/WebKit/public/web/WebDOMMediaStreamTrack.h" |
| 24 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 24 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 25 #include "webkit/common/fileapi/file_system_util.h" | 25 #include "storage/common/fileapi/file_system_util.h" |
| 26 | 26 |
| 27 using ppapi::ResourceVar; | 27 using ppapi::ResourceVar; |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 void FlushComplete( | 32 void FlushComplete( |
| 33 const base::Callback<void(bool)>& callback, | 33 const base::Callback<void(bool)>& callback, |
| 34 const std::vector<scoped_refptr<content::HostResourceVar> >& browser_vars, | 34 const std::vector<scoped_refptr<content::HostResourceVar> >& browser_vars, |
| 35 const std::vector<int>& pending_host_ids) { | 35 const std::vector<int>& pending_host_ids) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 50 case blink::WebFileSystem::TypeIsolated: | 50 case blink::WebFileSystem::TypeIsolated: |
| 51 return PP_FILESYSTEMTYPE_ISOLATED; | 51 return PP_FILESYSTEMTYPE_ISOLATED; |
| 52 case blink::WebFileSystem::TypeExternal: | 52 case blink::WebFileSystem::TypeExternal: |
| 53 return PP_FILESYSTEMTYPE_EXTERNAL; | 53 return PP_FILESYSTEMTYPE_EXTERNAL; |
| 54 default: | 54 default: |
| 55 NOTREACHED(); | 55 NOTREACHED(); |
| 56 return PP_FILESYSTEMTYPE_LOCALTEMPORARY; | 56 return PP_FILESYSTEMTYPE_LOCALTEMPORARY; |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Converts a fileapi::FileSystemType to a blink::WebFileSystemType. | 60 // Converts a storage::FileSystemType to a blink::WebFileSystemType. |
| 61 // Returns true on success, false if |type| does not correspond to a | 61 // Returns true on success, false if |type| does not correspond to a |
| 62 // WebFileSystemType. | 62 // WebFileSystemType. |
| 63 bool FileApiFileSystemTypeToWebFileSystemType( | 63 bool FileApiFileSystemTypeToWebFileSystemType( |
| 64 fileapi::FileSystemType type, | 64 storage::FileSystemType type, |
| 65 blink::WebFileSystemType* result_type) { | 65 blink::WebFileSystemType* result_type) { |
| 66 switch (type) { | 66 switch (type) { |
| 67 case fileapi::kFileSystemTypeTemporary: | 67 case storage::kFileSystemTypeTemporary: |
| 68 *result_type = blink::WebFileSystemTypeTemporary; | 68 *result_type = blink::WebFileSystemTypeTemporary; |
| 69 return true; | 69 return true; |
| 70 case fileapi::kFileSystemTypePersistent: | 70 case storage::kFileSystemTypePersistent: |
| 71 *result_type = blink::WebFileSystemTypePersistent; | 71 *result_type = blink::WebFileSystemTypePersistent; |
| 72 return true; | 72 return true; |
| 73 case fileapi::kFileSystemTypeIsolated: | 73 case storage::kFileSystemTypeIsolated: |
| 74 *result_type = blink::WebFileSystemTypeIsolated; | 74 *result_type = blink::WebFileSystemTypeIsolated; |
| 75 return true; | 75 return true; |
| 76 case fileapi::kFileSystemTypeExternal: | 76 case storage::kFileSystemTypeExternal: |
| 77 *result_type = blink::WebFileSystemTypeExternal; | 77 *result_type = blink::WebFileSystemTypeExternal; |
| 78 return true; | 78 return true; |
| 79 default: | 79 default: |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Given a V8 value containing a DOMFileSystem, creates a resource host and | 84 // Given a V8 value containing a DOMFileSystem, creates a resource host and |
| 85 // returns the resource information for serialization. | 85 // returns the resource information for serialization. |
| 86 // On error, false. | 86 // On error, false. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 file_system_type)); | 119 file_system_type)); |
| 120 return true; | 120 return true; |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool ResourceHostToDOMFileSystem( | 123 bool ResourceHostToDOMFileSystem( |
| 124 content::PepperFileSystemHost* file_system_host, | 124 content::PepperFileSystemHost* file_system_host, |
| 125 v8::Handle<v8::Context> context, | 125 v8::Handle<v8::Context> context, |
| 126 v8::Handle<v8::Value>* dom_file_system) { | 126 v8::Handle<v8::Value>* dom_file_system) { |
| 127 GURL root_url = file_system_host->GetRootUrl(); | 127 GURL root_url = file_system_host->GetRootUrl(); |
| 128 GURL origin; | 128 GURL origin; |
| 129 fileapi::FileSystemType type; | 129 storage::FileSystemType type; |
| 130 base::FilePath virtual_path; | 130 base::FilePath virtual_path; |
| 131 fileapi::ParseFileSystemSchemeURL(root_url, &origin, &type, &virtual_path); | 131 storage::ParseFileSystemSchemeURL(root_url, &origin, &type, &virtual_path); |
| 132 | 132 |
| 133 std::string name = fileapi::GetFileSystemName(origin, type); | 133 std::string name = storage::GetFileSystemName(origin, type); |
| 134 blink::WebFileSystemType blink_type; | 134 blink::WebFileSystemType blink_type; |
| 135 if (!FileApiFileSystemTypeToWebFileSystemType(type, &blink_type)) | 135 if (!FileApiFileSystemTypeToWebFileSystemType(type, &blink_type)) |
| 136 return false; | 136 return false; |
| 137 blink::WebLocalFrame* frame = blink::WebLocalFrame::frameForContext(context); | 137 blink::WebLocalFrame* frame = blink::WebLocalFrame::frameForContext(context); |
| 138 blink::WebDOMFileSystem web_dom_file_system = blink::WebDOMFileSystem::create( | 138 blink::WebDOMFileSystem web_dom_file_system = blink::WebDOMFileSystem::create( |
| 139 frame, | 139 frame, |
| 140 blink_type, | 140 blink_type, |
| 141 blink::WebString::fromUTF8(name), | 141 blink::WebString::fromUTF8(name), |
| 142 root_url, | 142 root_url, |
| 143 blink::WebDOMFileSystem::SerializableTypeSerializable); | 143 blink::WebDOMFileSystem::SerializableTypeSerializable); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 const IPC::Message& create_message, | 344 const IPC::Message& create_message, |
| 345 const IPC::Message& browser_host_create_message) { | 345 const IPC::Message& browser_host_create_message) { |
| 346 scoped_refptr<HostResourceVar> result = | 346 scoped_refptr<HostResourceVar> result = |
| 347 CreateResourceVar(pending_renderer_id, create_message); | 347 CreateResourceVar(pending_renderer_id, create_message); |
| 348 browser_host_create_messages_.push_back(browser_host_create_message); | 348 browser_host_create_messages_.push_back(browser_host_create_message); |
| 349 browser_vars_.push_back(result); | 349 browser_vars_.push_back(result); |
| 350 return result; | 350 return result; |
| 351 } | 351 } |
| 352 | 352 |
| 353 } // namespace content | 353 } // namespace content |
| OLD | NEW |