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 CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ |
7 | 7 |
8 #include "chrome/browser/extensions/external_loader.h" | 8 #include "chrome/browser/extensions/external_loader.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 17 matching lines...) Expand all Loading... |
28 // that all components of the path to external extensions files are | 28 // that all components of the path to external extensions files are |
29 // owned by root and not writable by any non-root user. | 29 // owned by root and not writable by any non-root user. |
30 ENSURE_PATH_CONTROLLED_BY_ADMIN = 1 << 0 | 30 ENSURE_PATH_CONTROLLED_BY_ADMIN = 1 << 0 |
31 }; | 31 }; |
32 | 32 |
33 // |base_path_id| is the directory containing the external_extensions.json | 33 // |base_path_id| is the directory containing the external_extensions.json |
34 // file or the standalone extension manifest files. Relative file paths to | 34 // file or the standalone extension manifest files. Relative file paths to |
35 // extension files are resolved relative to this path. | 35 // extension files are resolved relative to this path. |
36 ExternalPrefLoader(int base_path_id, Options options); | 36 ExternalPrefLoader(int base_path_id, Options options); |
37 | 37 |
38 virtual const base::FilePath GetBaseCrxFilePath() OVERRIDE; | 38 virtual const base::FilePath GetBaseCrxFilePath() override; |
39 | 39 |
40 protected: | 40 protected: |
41 virtual ~ExternalPrefLoader() {} | 41 virtual ~ExternalPrefLoader() {} |
42 | 42 |
43 virtual void StartLoading() OVERRIDE; | 43 virtual void StartLoading() override; |
44 bool IsOptionSet(Options option) { | 44 bool IsOptionSet(Options option) { |
45 return (options_ & option) != 0; | 45 return (options_ & option) != 0; |
46 } | 46 } |
47 | 47 |
48 // The resource id of the base path with the information about the json | 48 // The resource id of the base path with the information about the json |
49 // file containing which extensions to load. | 49 // file containing which extensions to load. |
50 const int base_path_id_; | 50 const int base_path_id_; |
51 | 51 |
52 const Options options_; | 52 const Options options_; |
53 | 53 |
(...skipping 25 matching lines...) Expand all Loading... |
79 DISALLOW_COPY_AND_ASSIGN(ExternalPrefLoader); | 79 DISALLOW_COPY_AND_ASSIGN(ExternalPrefLoader); |
80 }; | 80 }; |
81 | 81 |
82 // A simplified version of ExternalPrefLoader that loads the dictionary | 82 // A simplified version of ExternalPrefLoader that loads the dictionary |
83 // from json data specified in a string. | 83 // from json data specified in a string. |
84 class ExternalTestingLoader : public ExternalLoader { | 84 class ExternalTestingLoader : public ExternalLoader { |
85 public: | 85 public: |
86 ExternalTestingLoader(const std::string& json_data, | 86 ExternalTestingLoader(const std::string& json_data, |
87 const base::FilePath& fake_base_path); | 87 const base::FilePath& fake_base_path); |
88 | 88 |
89 virtual const base::FilePath GetBaseCrxFilePath() OVERRIDE; | 89 virtual const base::FilePath GetBaseCrxFilePath() override; |
90 | 90 |
91 protected: | 91 protected: |
92 virtual void StartLoading() OVERRIDE; | 92 virtual void StartLoading() override; |
93 | 93 |
94 private: | 94 private: |
95 friend class base::RefCountedThreadSafe<ExternalLoader>; | 95 friend class base::RefCountedThreadSafe<ExternalLoader>; |
96 | 96 |
97 virtual ~ExternalTestingLoader(); | 97 virtual ~ExternalTestingLoader(); |
98 | 98 |
99 base::FilePath fake_base_path_; | 99 base::FilePath fake_base_path_; |
100 scoped_ptr<base::DictionaryValue> testing_prefs_; | 100 scoped_ptr<base::DictionaryValue> testing_prefs_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(ExternalTestingLoader); | 102 DISALLOW_COPY_AND_ASSIGN(ExternalTestingLoader); |
103 }; | 103 }; |
104 | 104 |
105 } // namespace extensions | 105 } // namespace extensions |
106 | 106 |
107 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ | 107 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PREF_LOADER_H_ |
OLD | NEW |