OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_HOST_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_HOST_CONTEXT_H_ |
6 #define CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_HOST_CONTEXT_H_ | 6 #define CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_HOST_CONTEXT_H_ |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
11 #include "googleurl/src/gurl.h" | 11 #include "webkit/fileapi/file_system_types.h" |
12 #include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" | 12 |
| 13 class GURL; |
13 | 14 |
14 // This is owned by profile and shared by all the FileSystemDispatcherHost | 15 // This is owned by profile and shared by all the FileSystemDispatcherHost |
15 // that shared by the same profile. | 16 // that shared by the same profile. |
16 class FileSystemHostContext | 17 class FileSystemHostContext |
17 : public base::RefCountedThreadSafe<FileSystemHostContext> { | 18 : public base::RefCountedThreadSafe<FileSystemHostContext> { |
18 public: | 19 public: |
19 FileSystemHostContext(const FilePath& data_path, bool is_incognito); | 20 FileSystemHostContext(const FilePath& data_path, bool is_incognito); |
20 const FilePath& base_path() const { return base_path_; } | 21 const FilePath& base_path() const { return base_path_; } |
21 bool is_incognito() const { return is_incognito_; } | 22 bool is_incognito() const { return is_incognito_; } |
22 | 23 |
23 // Returns the root path and name for the file system specified by given | 24 // Returns the root path and name for the file system specified by given |
24 // |origin_url| and |type|. Returns true if the file system is available | 25 // |origin_url| and |type|. Returns true if the file system is available |
25 // for the profile and |root_path| and |name| are filled successfully. | 26 // for the profile and |root_path| and |name| are filled successfully. |
26 bool GetFileSystemRootPath( | 27 bool GetFileSystemRootPath(const GURL& origin_url, |
27 const GURL& origin_url, | 28 fileapi::FileSystemType type, |
28 WebKit::WebFileSystem::Type type, | 29 FilePath* root_path, |
29 FilePath* root_path, | 30 std::string* name) const; |
30 std::string* name) const; | |
31 | 31 |
32 // Check if the given |path| is in the FileSystem base directory. | 32 // Check if the given |path| is in the FileSystem base directory. |
33 bool CheckValidFileSystemPath(const FilePath& path) const; | 33 bool CheckValidFileSystemPath(const FilePath& path) const; |
34 | 34 |
35 // Returns the storage identifier string for the given |url|. | 35 // Returns the storage identifier string for the given |url|. |
36 static std::string GetStorageIdentifierFromURL(const GURL& url); | 36 static std::string GetStorageIdentifierFromURL(const GURL& url); |
37 | 37 |
38 // The FileSystem directory name. | 38 // The FileSystem directory name. |
39 static const FilePath::CharType kFileSystemDirectory[]; | 39 static const FilePath::CharType kFileSystemDirectory[]; |
40 | 40 |
41 static const char kPersistentName[]; | 41 static const char kPersistentName[]; |
42 static const char kTemporaryName[]; | 42 static const char kTemporaryName[]; |
43 | 43 |
44 private: | 44 private: |
45 const FilePath base_path_; | 45 const FilePath base_path_; |
46 const bool is_incognito_; | 46 const bool is_incognito_; |
47 | 47 |
48 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemHostContext); | 48 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemHostContext); |
49 }; | 49 }; |
50 | 50 |
51 #endif // CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_HOST_CONTEXT_H_ | 51 #endif // CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_HOST_CONTEXT_H_ |
OLD | NEW |