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

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

Issue 10713007: Make isolated file system works for a device root (e.g. X:\\) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
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/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"
11 #include "content/renderer/render_view_impl.h" 11 #include "content/renderer/render_view_impl.h"
12 #include "ipc/ipc_message.h" 12 #include "ipc/ipc_message.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlob.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlob.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeliveredIntentCli ent.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeliveredIntentCli ent.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntent.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntent.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentRequest.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentRequest.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h " 21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h "
22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste m.h" 22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste m.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize dScriptValue.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize dScriptValue.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
26 #include "v8/include/v8.h" 26 #include "v8/include/v8.h"
27 #include "webkit/fileapi/file_system_util.h" 27 #include "webkit/fileapi/file_system_util.h"
28 #include "webkit/fileapi/isolated_context.h"
28 #include "webkit/glue/cpp_bound_class.h" 29 #include "webkit/glue/cpp_bound_class.h"
29 30
30 using WebKit::WebBindings; 31 using WebKit::WebBindings;
31 using WebKit::WebBlob; 32 using WebKit::WebBlob;
32 using WebKit::WebCString; 33 using WebKit::WebCString;
33 using WebKit::WebDeliveredIntentClient; 34 using WebKit::WebDeliveredIntentClient;
34 using WebKit::WebFrame; 35 using WebKit::WebFrame;
35 using WebKit::WebIntent; 36 using WebKit::WebIntent;
36 using WebKit::WebIntentRequest; 37 using WebKit::WebIntentRequest;
37 using WebKit::WebString; 38 using WebKit::WebString;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } else if (intent_->data_type == webkit_glue::WebIntentData::FILESYSTEM) { 174 } else if (intent_->data_type == webkit_glue::WebIntentData::FILESYSTEM) {
174 const GURL origin = GURL(frame->document().securityOrigin().toString()); 175 const GURL origin = GURL(frame->document().securityOrigin().toString());
175 const GURL root_url = 176 const GURL root_url =
176 fileapi::GetFileSystemRootURI(origin, fileapi::kFileSystemTypeIsolated); 177 fileapi::GetFileSystemRootURI(origin, fileapi::kFileSystemTypeIsolated);
177 const std::string fsname = 178 const std::string fsname =
178 fileapi::GetIsolatedFileSystemName(origin, intent_->filesystem_id); 179 fileapi::GetIsolatedFileSystemName(origin, intent_->filesystem_id);
179 const std::string url = base::StringPrintf( 180 const std::string url = base::StringPrintf(
180 "%s%s/%s/", 181 "%s%s/%s/",
181 root_url.spec().c_str(), 182 root_url.spec().c_str(),
182 intent_->filesystem_id.c_str(), 183 intent_->filesystem_id.c_str(),
183 intent_->root_path.BaseName().AsUTF8Unsafe().c_str()); 184 intent_->root_name.c_str());
184 // TODO(kmadhusu): This is a temporary hack to create a serializable file 185 // 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, 186 // system. Once we have a better way to create a serializable file system,
186 // remove this hack. 187 // remove this hack.
187 v8::Handle<v8::Value> filesystem_V8 = frame->createSerializableFileSystem( 188 v8::Handle<v8::Value> filesystem_V8 = frame->createSerializableFileSystem(
188 WebKit::WebFileSystem::TypeIsolated, 189 WebKit::WebFileSystem::TypeIsolated,
189 WebKit::WebString::fromUTF8(fsname), 190 WebKit::WebString::fromUTF8(fsname),
190 WebKit::WebString::fromUTF8(url)); 191 WebKit::WebString::fromUTF8(url));
191 WebSerializedScriptValue serialized_data = 192 WebSerializedScriptValue serialized_data =
192 WebSerializedScriptValue::serialize(filesystem_V8); 193 WebSerializedScriptValue::serialize(filesystem_V8);
193 web_intent = WebIntent::create(intent_->action, intent_->type, 194 web_intent = WebIntent::create(intent_->action, intent_->type,
194 serialized_data.toString(), 195 serialized_data.toString(),
195 extras_keys, extras_values); 196 extras_keys, extras_values);
196 } else { 197 } else {
197 NOTREACHED(); 198 NOTREACHED();
198 } 199 }
199 200
200 if (!web_intent.action().isEmpty()) 201 if (!web_intent.action().isEmpty())
201 frame->deliverIntent(web_intent, NULL, delivered_intent_client_.get()); 202 frame->deliverIntent(web_intent, NULL, delivered_intent_client_.get());
202 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698