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: chrome/renderer/extensions/experimental.app_custom_bindings.cc

Issue 10332071: Pass command line arguments onto platform apps which provide the right intent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fixed, postResult added Created 8 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/renderer/extensions/experimental.app_custom_bindings.h"
6
7 #include <string>
8
9 #include "base/basictypes.h"
10 #include "base/logging.h"
11 #include "chrome/renderer/extensions/user_script_slave.h"
12 #include "grit/renderer_resources.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste m.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
16
17 namespace {
18
19 static v8::Handle<v8::Value> GetIsolatedFileSystem(
20 const v8::Arguments& args) {
21 DCHECK(args.Length() == 1);
22 DCHECK(args[0]->IsString());
23 std::string file_system_id(*v8::String::Utf8Value(args[0]));
24 WebKit::WebFrame* webframe = WebKit::WebFrame::frameForCurrentContext();
25 DCHECK(webframe);
26
27 GURL context_url = UserScriptSlave::GetDataSourceURLForFrame(webframe);
Mihai Parparita -not on Chrome 2012/05/18 04:26:04 Might be safe to add a CHECK that this is an exten
benwells 2012/05/22 13:15:03 Done.
28 std::string name = context_url.GetOrigin().spec();
29 name.append("isolated/");
Mihai Parparita -not on Chrome 2012/05/18 04:26:04 Seems like you can use GetFileSystemRootURI(contex
benwells 2012/05/18 04:56:55 That isn't implemented for isolated file systems,
kinuko 2012/05/18 10:22:17 It was correct, but I just added the minimal suppo
benwells 2012/05/22 13:15:03 Nice! Done.
30 name.append(file_system_id);
31
32 std::string root;
33 root.append("filesystem:");
34 root.append(context_url.GetOrigin().spec());
35 root.append("isolated/");
36 root.append(file_system_id);
37 root.append("/");
38
39 return webframe->createFileSystem(
40 WebKit::WebFileSystem::TypeIsolated,
41 WebKit::WebString::fromUTF8(name.c_str()),
42 WebKit::WebString::fromUTF8(root.c_str()));
43 }
44
45 } // namespace
46
47 namespace extensions {
48
49 ExperimentalAppCustomBindings::ExperimentalAppCustomBindings()
50 : ChromeV8Extension(NULL) {
51 RouteStaticFunction("GetIsolatedFileSystem", &GetIsolatedFileSystem);
52 }
53
54 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698