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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 // Actually searches for and loads candidate standalone extension preference | 57 // Actually searches for and loads candidate standalone extension preference |
58 // files in the path corresponding to |base_path_id|. | 58 // files in the path corresponding to |base_path_id|. |
59 // Must be called on the file thread. | 59 // Must be called on the file thread. |
60 void LoadOnFileThread(); | 60 void LoadOnFileThread(); |
61 | 61 |
62 // Extracts the information contained in an external_extension.json file | 62 // Extracts the information contained in an external_extension.json file |
63 // regarding which extensions to install. |prefs| will be modified to | 63 // regarding which extensions to install. |prefs| will be modified to |
64 // receive the extracted extension information. | 64 // receive the extracted extension information. |
65 // Must be called from the File thread. | 65 // Must be called from the File thread. |
66 void ReadExternalExtensionPrefFile(DictionaryValue * prefs); | 66 void ReadExternalExtensionPrefFile(base::DictionaryValue* prefs); |
67 | 67 |
68 // Extracts the information contained in standalone external extension | 68 // Extracts the information contained in standalone external extension |
69 // json files (<extension id>.json) regarding what external extensions | 69 // json files (<extension id>.json) regarding what external extensions |
70 // to install. |prefs| will be modified to receive the extracted extension | 70 // to install. |prefs| will be modified to receive the extracted extension |
71 // information. | 71 // information. |
72 // Must be called from the File thread. | 72 // Must be called from the File thread. |
73 void ReadStandaloneExtensionPrefFiles(DictionaryValue * prefs); | 73 void ReadStandaloneExtensionPrefFiles(base::DictionaryValue* prefs); |
74 | 74 |
75 // The path (coresponding to |base_path_id_| containing the json files | 75 // The path (coresponding to |base_path_id_| containing the json files |
76 // describing which extensions to load. | 76 // describing which extensions to load. |
77 base::FilePath base_path_; | 77 base::FilePath base_path_; |
78 | 78 |
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<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 |