| 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 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPTIONS_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPTIONS_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPTIONS_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPTIONS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "webkit/browser/webkit_storage_browser_export.h" | 11 #include "storage/common/storage_export.h" |
| 12 | 12 |
| 13 namespace leveldb { | 13 namespace leveldb { |
| 14 class Env; | 14 class Env; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace fileapi { | 17 namespace storage { |
| 18 | 18 |
| 19 // Provides runtime options that may change FileSystem API behavior. | 19 // Provides runtime options that may change FileSystem API behavior. |
| 20 // This object is copyable. | 20 // This object is copyable. |
| 21 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOptions { | 21 class STORAGE_EXPORT FileSystemOptions { |
| 22 public: | 22 public: |
| 23 enum ProfileMode { | 23 enum ProfileMode { PROFILE_MODE_NORMAL = 0, PROFILE_MODE_INCOGNITO }; |
| 24 PROFILE_MODE_NORMAL = 0, | |
| 25 PROFILE_MODE_INCOGNITO | |
| 26 }; | |
| 27 | 24 |
| 28 // |profile_mode| specifies if the profile (for this filesystem) | 25 // |profile_mode| specifies if the profile (for this filesystem) |
| 29 // is running in incognito mode (PROFILE_MODE_INCOGNITO) or no | 26 // is running in incognito mode (PROFILE_MODE_INCOGNITO) or no |
| 30 // (PROFILE_MODE_NORMAL). | 27 // (PROFILE_MODE_NORMAL). |
| 31 // |additional_allowed_schemes| specifies schemes that are allowed | 28 // |additional_allowed_schemes| specifies schemes that are allowed |
| 32 // to access FileSystem API in addition to "http" and "https". | 29 // to access FileSystem API in addition to "http" and "https". |
| 33 // Non-NULL |env_override| overrides internal LevelDB environment. | 30 // Non-NULL |env_override| overrides internal LevelDB environment. |
| 34 FileSystemOptions( | 31 FileSystemOptions(ProfileMode profile_mode, |
| 35 ProfileMode profile_mode, | 32 const std::vector<std::string>& additional_allowed_schemes, |
| 36 const std::vector<std::string>& additional_allowed_schemes, | 33 leveldb::Env* env_override); |
| 37 leveldb::Env* env_override); | |
| 38 | 34 |
| 39 ~FileSystemOptions(); | 35 ~FileSystemOptions(); |
| 40 | 36 |
| 41 // Returns true if it is running in the incognito mode. | 37 // Returns true if it is running in the incognito mode. |
| 42 bool is_incognito() const { return profile_mode_ == PROFILE_MODE_INCOGNITO; } | 38 bool is_incognito() const { return profile_mode_ == PROFILE_MODE_INCOGNITO; } |
| 43 | 39 |
| 44 // Returns the schemes that must be allowed to access FileSystem API | 40 // Returns the schemes that must be allowed to access FileSystem API |
| 45 // in addition to standard "http" and "https". | 41 // in addition to standard "http" and "https". |
| 46 // (e.g. If the --allow-file-access-from-files option is given in chrome | 42 // (e.g. If the --allow-file-access-from-files option is given in chrome |
| 47 // "file" scheme will also need to be allowed). | 43 // "file" scheme will also need to be allowed). |
| 48 const std::vector<std::string>& additional_allowed_schemes() const { | 44 const std::vector<std::string>& additional_allowed_schemes() const { |
| 49 return additional_allowed_schemes_; | 45 return additional_allowed_schemes_; |
| 50 } | 46 } |
| 51 | 47 |
| 52 leveldb::Env* env_override() const { return env_override_; } | 48 leveldb::Env* env_override() const { return env_override_; } |
| 53 | 49 |
| 54 private: | 50 private: |
| 55 const ProfileMode profile_mode_; | 51 const ProfileMode profile_mode_; |
| 56 const std::vector<std::string> additional_allowed_schemes_; | 52 const std::vector<std::string> additional_allowed_schemes_; |
| 57 leveldb::Env* env_override_; | 53 leveldb::Env* env_override_; |
| 58 }; | 54 }; |
| 59 | 55 |
| 60 } // namespace fileapi | 56 } // namespace storage |
| 61 | 57 |
| 62 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPTIONS_H_ | 58 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPTIONS_H_ |
| OLD | NEW |