| OLD | NEW |
| 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 "chrome/renderer/extensions/file_system_natives.h" | 5 #include "chrome/renderer/extensions/file_system_natives.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 WebKit::WebFrame* webframe = WebKit::WebFrame::frameForCurrentContext(); | 27 WebKit::WebFrame* webframe = WebKit::WebFrame::frameForCurrentContext(); |
| 28 DCHECK(webframe); | 28 DCHECK(webframe); |
| 29 | 29 |
| 30 GURL context_url = | 30 GURL context_url = |
| 31 extensions::UserScriptSlave::GetDataSourceURLForFrame(webframe); | 31 extensions::UserScriptSlave::GetDataSourceURLForFrame(webframe); |
| 32 CHECK(context_url.SchemeIs(chrome::kExtensionScheme)); | 32 CHECK(context_url.SchemeIs(chrome::kExtensionScheme)); |
| 33 | 33 |
| 34 std::string name(fileapi::GetIsolatedFileSystemName(context_url.GetOrigin(), | 34 std::string name(fileapi::GetIsolatedFileSystemName(context_url.GetOrigin(), |
| 35 file_system_id)); | 35 file_system_id)); |
| 36 | 36 |
| 37 std::string root(fileapi::GetFileSystemRootURI(context_url.GetOrigin(), | 37 std::string root(fileapi::GetFileSystemRootURI( |
| 38 fileapi::kFileSystemTypeIsolated).spec()); | 38 context_url.GetOrigin(), |
| 39 fileapi::kFileSystemTypeIsolated).spec()); |
| 39 root.append(file_system_id); | 40 root.append(file_system_id); |
| 40 root.append("/"); | 41 root.append("/"); |
| 41 | 42 |
| 42 return webframe->createFileSystem( | 43 return webframe->createFileSystem( |
| 43 WebKit::WebFileSystem::TypeIsolated, | 44 WebKit::WebFileSystem::TypeIsolated, |
| 44 WebKit::WebString::fromUTF8(name.c_str()), | 45 WebKit::WebString::fromUTF8(name.c_str()), |
| 45 WebKit::WebString::fromUTF8(root.c_str())); | 46 WebKit::WebString::fromUTF8(root.c_str())); |
| 46 } | 47 } |
| 47 | 48 |
| 48 } // namespace | 49 } // namespace |
| 49 | 50 |
| 50 namespace extensions { | 51 namespace extensions { |
| 51 | 52 |
| 52 FileSystemNatives::FileSystemNatives() | 53 FileSystemNatives::FileSystemNatives() |
| 53 : ChromeV8Extension(NULL) { | 54 : ChromeV8Extension(NULL) { |
| 54 RouteStaticFunction("GetIsolatedFileSystem", &GetIsolatedFileSystem); | 55 RouteStaticFunction("GetIsolatedFileSystem", &GetIsolatedFileSystem); |
| 55 } | 56 } |
| 56 | 57 |
| 57 } // namespace extensions | 58 } // namespace extensions |
| OLD | NEW |