| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/file_system_natives.h" | 5 #include "extensions/renderer/file_system_natives.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "extensions/common/constants.h" | 9 #include "extensions/common/constants.h" |
| 10 #include "extensions/renderer/script_context.h" | 10 #include "extensions/renderer/script_context.h" |
| 11 #include "storage/common/fileapi/file_system_types.h" | 11 #include "storage/common/fileapi/file_system_types.h" |
| 12 #include "storage/common/fileapi/file_system_util.h" | 12 #include "storage/common/fileapi/file_system_util.h" |
| 13 #include "third_party/WebKit/public/platform/WebString.h" | 13 #include "third_party/WebKit/public/platform/WebString.h" |
| 14 #include "third_party/WebKit/public/web/WebDOMFileSystem.h" | 14 #include "third_party/WebKit/public/web/WebDOMFileSystem.h" |
| 15 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 15 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 16 #include "url/origin.h" | 16 #include "url/origin.h" |
| 17 | 17 |
| 18 namespace extensions { | 18 namespace extensions { |
| 19 | 19 |
| 20 FileSystemNatives::FileSystemNatives(ScriptContext* context) | 20 FileSystemNatives::FileSystemNatives(ScriptContext* context) |
| 21 : ObjectBackedNativeHandler(context) { | 21 : ObjectBackedNativeHandler(context) { |
| 22 RouteFunction( | 22 RouteFunction( |
| 23 "GetFileEntry", | 23 "GetFileEntry", |
| 24 "syncFileSystem", |
| 24 base::Bind(&FileSystemNatives::GetFileEntry, base::Unretained(this))); | 25 base::Bind(&FileSystemNatives::GetFileEntry, base::Unretained(this))); |
| 25 RouteFunction("GetIsolatedFileSystem", | 26 RouteFunction("GetIsolatedFileSystem", |
| 26 base::Bind(&FileSystemNatives::GetIsolatedFileSystem, | 27 base::Bind(&FileSystemNatives::GetIsolatedFileSystem, |
| 27 base::Unretained(this))); | 28 base::Unretained(this))); |
| 28 RouteFunction("CrackIsolatedFileSystemName", | 29 RouteFunction("CrackIsolatedFileSystemName", "fileSystem", |
| 29 base::Bind(&FileSystemNatives::CrackIsolatedFileSystemName, | 30 base::Bind(&FileSystemNatives::CrackIsolatedFileSystemName, |
| 30 base::Unretained(this))); | 31 base::Unretained(this))); |
| 31 } | 32 } |
| 32 | 33 |
| 33 void FileSystemNatives::GetIsolatedFileSystem( | 34 void FileSystemNatives::GetIsolatedFileSystem( |
| 34 const v8::FunctionCallbackInfo<v8::Value>& args) { | 35 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 35 CHECK(args.Length() == 1 || args.Length() == 2); | 36 CHECK(args.Length() == 1 || args.Length() == 2); |
| 36 CHECK(args[0]->IsString()); | 37 CHECK(args[0]->IsString()); |
| 37 std::string file_system_id(*v8::String::Utf8Value(args[0])); | 38 std::string file_system_id(*v8::String::Utf8Value(args[0])); |
| 38 blink::WebLocalFrame* webframe = | 39 blink::WebLocalFrame* webframe = |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if (!storage::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id)) | 116 if (!storage::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id)) |
| 116 return; | 117 return; |
| 117 | 118 |
| 118 args.GetReturnValue().Set(v8::String::NewFromUtf8(args.GetIsolate(), | 119 args.GetReturnValue().Set(v8::String::NewFromUtf8(args.GetIsolate(), |
| 119 filesystem_id.c_str(), | 120 filesystem_id.c_str(), |
| 120 v8::String::kNormalString, | 121 v8::String::kNormalString, |
| 121 filesystem_id.size())); | 122 filesystem_id.size())); |
| 122 } | 123 } |
| 123 | 124 |
| 124 } // namespace extensions | 125 } // namespace extensions |
| OLD | NEW |