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/web_intents_host.h" | 5 #include "content/renderer/web_intents_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/common/intents_messages.h" | 10 #include "content/common/intents_messages.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 intent_->blob_length); | 167 intent_->blob_length); |
168 WebSerializedScriptValue serialized_data = | 168 WebSerializedScriptValue serialized_data = |
169 WebSerializedScriptValue::serialize(web_blob_.toV8Value()); | 169 WebSerializedScriptValue::serialize(web_blob_.toV8Value()); |
170 web_intent = WebIntent::create(intent_->action, intent_->type, | 170 web_intent = WebIntent::create(intent_->action, intent_->type, |
171 serialized_data.toString(), | 171 serialized_data.toString(), |
172 extras_keys, extras_values); | 172 extras_keys, extras_values); |
173 } else if (intent_->data_type == webkit_glue::WebIntentData::FILESYSTEM) { | 173 } else if (intent_->data_type == webkit_glue::WebIntentData::FILESYSTEM) { |
174 const GURL origin = GURL(frame->document().securityOrigin().toString()); | 174 const GURL origin = GURL(frame->document().securityOrigin().toString()); |
175 const GURL root_url = | 175 const GURL root_url = |
176 fileapi::GetFileSystemRootURI(origin, fileapi::kFileSystemTypeIsolated); | 176 fileapi::GetFileSystemRootURI(origin, fileapi::kFileSystemTypeIsolated); |
177 const std::string fsname = | |
178 fileapi::GetIsolatedFileSystemName(origin, intent_->filesystem_id); | |
179 const std::string url = base::StringPrintf( | 177 const std::string url = base::StringPrintf( |
180 "%s%s/%s/", | 178 "%s%s/%s/", |
181 root_url.spec().c_str(), | 179 root_url.spec().c_str(), |
182 intent_->filesystem_id.c_str(), | 180 intent_->filesystem_id.c_str(), |
183 intent_->root_name.c_str()); | 181 intent_->root_name.c_str()); |
184 // TODO(kmadhusu): This is a temporary hack to create a serializable file | 182 // TODO(kmadhusu): This is a temporary hack to create a serializable file |
185 // system. Once we have a better way to create a serializable file system, | 183 // system. Once we have a better way to create a serializable file system, |
186 // remove this hack. | 184 // remove this hack. |
187 v8::Handle<v8::Value> filesystem_V8 = frame->createSerializableFileSystem( | 185 v8::Handle<v8::Value> filesystem_V8 = frame->createSerializableFileSystem( |
188 WebKit::WebFileSystem::TypeIsolated, | 186 WebKit::WebFileSystem::TypeIsolated, |
189 WebKit::WebString::fromUTF8(fsname), | 187 WebKit::WebString::fromUTF8(intent_->root_name), |
190 WebKit::WebString::fromUTF8(url)); | 188 WebKit::WebString::fromUTF8(url)); |
191 WebSerializedScriptValue serialized_data = | 189 WebSerializedScriptValue serialized_data = |
192 WebSerializedScriptValue::serialize(filesystem_V8); | 190 WebSerializedScriptValue::serialize(filesystem_V8); |
193 web_intent = WebIntent::create(intent_->action, intent_->type, | 191 web_intent = WebIntent::create(intent_->action, intent_->type, |
194 serialized_data.toString(), | 192 serialized_data.toString(), |
195 extras_keys, extras_values); | 193 extras_keys, extras_values); |
196 } else { | 194 } else { |
197 NOTREACHED(); | 195 NOTREACHED(); |
198 } | 196 } |
199 | 197 |
200 if (!web_intent.action().isEmpty()) | 198 if (!web_intent.action().isEmpty()) |
201 frame->deliverIntent(web_intent, NULL, delivered_intent_client_.get()); | 199 frame->deliverIntent(web_intent, NULL, delivered_intent_client_.get()); |
202 } | 200 } |
OLD | NEW |