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

Unified 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: Windows tests fixed 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/extensions/experimental.app_custom_bindings.cc
diff --git a/chrome/renderer/extensions/experimental.app_custom_bindings.cc b/chrome/renderer/extensions/experimental.app_custom_bindings.cc
new file mode 100644
index 0000000000000000000000000000000000000000..683f883db6332d027164bb908b72d568b97b398c
--- /dev/null
+++ b/chrome/renderer/extensions/experimental.app_custom_bindings.cc
@@ -0,0 +1,57 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/renderer/extensions/experimental.app_custom_bindings.h"
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "chrome/common/url_constants.h"
+#include "chrome/renderer/extensions/user_script_slave.h"
+#include "grit/renderer_resources.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
+#include "webkit/fileapi/file_system_types.h"
+#include "webkit/fileapi/file_system_util.h"
+
+namespace {
+
+static v8::Handle<v8::Value> GetIsolatedFileSystem(
+ const v8::Arguments& args) {
+ DCHECK(args.Length() == 1);
+ DCHECK(args[0]->IsString());
+ std::string file_system_id(*v8::String::Utf8Value(args[0]));
+ WebKit::WebFrame* webframe = WebKit::WebFrame::frameForCurrentContext();
+ DCHECK(webframe);
+
+ GURL context_url = UserScriptSlave::GetDataSourceURLForFrame(webframe);
+ CHECK(context_url.SchemeIs(chrome::kExtensionScheme));
+
+ std::string name(fileapi::GetFileSystemName(context_url.GetOrigin(),
+ fileapi::kFileSystemTypeIsolated));
+ name.append(file_system_id);
+
+ std::string root(fileapi::GetFileSystemRootURI(context_url.GetOrigin(),
+ fileapi::kFileSystemTypeIsolated).spec());
+ root.append(file_system_id);
+ root.append("/");
+
+ return webframe->createFileSystem(
+ WebKit::WebFileSystem::TypeIsolated,
+ WebKit::WebString::fromUTF8(name.c_str()),
+ WebKit::WebString::fromUTF8(root.c_str()));
+}
+
+} // namespace
+
+namespace extensions {
+
+ExperimentalAppCustomBindings::ExperimentalAppCustomBindings()
+ : ChromeV8Extension(NULL) {
+ RouteStaticFunction("GetIsolatedFileSystem", &GetIsolatedFileSystem);
+}
+
+} // namespace extensions
« no previous file with comments | « chrome/renderer/extensions/experimental.app_custom_bindings.h ('k') | chrome/renderer/extensions/extension_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698