| 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", | |
| 25 base::Bind(&FileSystemNatives::GetFileEntry, base::Unretained(this))); | 24 base::Bind(&FileSystemNatives::GetFileEntry, base::Unretained(this))); |
| 26 RouteFunction("GetIsolatedFileSystem", | 25 RouteFunction("GetIsolatedFileSystem", |
| 27 base::Bind(&FileSystemNatives::GetIsolatedFileSystem, | 26 base::Bind(&FileSystemNatives::GetIsolatedFileSystem, |
| 28 base::Unretained(this))); | 27 base::Unretained(this))); |
| 29 RouteFunction("CrackIsolatedFileSystemName", "fileSystem", | 28 RouteFunction("CrackIsolatedFileSystemName", |
| 30 base::Bind(&FileSystemNatives::CrackIsolatedFileSystemName, | 29 base::Bind(&FileSystemNatives::CrackIsolatedFileSystemName, |
| 31 base::Unretained(this))); | 30 base::Unretained(this))); |
| 32 } | 31 } |
| 33 | 32 |
| 34 void FileSystemNatives::GetIsolatedFileSystem( | 33 void FileSystemNatives::GetIsolatedFileSystem( |
| 35 const v8::FunctionCallbackInfo<v8::Value>& args) { | 34 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 36 CHECK(args.Length() == 1 || args.Length() == 2); | 35 CHECK(args.Length() == 1 || args.Length() == 2); |
| 37 CHECK(args[0]->IsString()); | 36 CHECK(args[0]->IsString()); |
| 38 std::string file_system_id(*v8::String::Utf8Value(args[0])); | 37 std::string file_system_id(*v8::String::Utf8Value(args[0])); |
| 39 blink::WebLocalFrame* webframe = | 38 blink::WebLocalFrame* webframe = |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 if (!storage::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id)) | 115 if (!storage::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id)) |
| 117 return; | 116 return; |
| 118 | 117 |
| 119 args.GetReturnValue().Set(v8::String::NewFromUtf8(args.GetIsolate(), | 118 args.GetReturnValue().Set(v8::String::NewFromUtf8(args.GetIsolate(), |
| 120 filesystem_id.c_str(), | 119 filesystem_id.c_str(), |
| 121 v8::String::kNormalString, | 120 v8::String::kNormalString, |
| 122 filesystem_id.size())); | 121 filesystem_id.size())); |
| 123 } | 122 } |
| 124 | 123 |
| 125 } // namespace extensions | 124 } // namespace extensions |
| OLD | NEW |