Chromium Code Reviews| 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_POLICY_LOADER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "chrome/browser/extensions/extension_management.h" | 11 #include "chrome/browser/extensions/extension_management.h" |
| 12 #include "chrome/browser/extensions/external_loader.h" | 12 #include "chrome/browser/extensions/external_loader.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class DictionaryValue; | 15 class DictionaryValue; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace extensions { | 18 namespace extensions { |
| 19 | 19 |
| 20 // A specialization of the ExternalProvider that uses extension management | 20 // A specialization of the ExternalProvider that uses extension management |
| 21 // policies to look up which external extensions are registered. | 21 // policies to look up which external extensions are registered. |
| 22 class ExternalPolicyLoader : public ExternalLoader, | 22 class ExternalPolicyLoader : public ExternalLoader, |
| 23 public ExtensionManagement::Observer { | 23 public ExtensionManagement::Observer { |
| 24 public: | 24 public: |
| 25 explicit ExternalPolicyLoader(ExtensionManagement* settings); | 25 // Indicates which kind of extensions this class will provide, according to |
| 26 // management polcies. | |
| 27 enum InstallationType { FORCED, RECOMMENDED }; | |
|
Joao da Silva
2014/09/18 12:21:23
Break each constant into a line and document what
binjin
2014/09/18 16:25:15
Done.
| |
| 28 | |
| 29 ExternalPolicyLoader(ExtensionManagement* settings, InstallationType type); | |
| 26 | 30 |
| 27 // ExtensionManagement::Observer implementation | 31 // ExtensionManagement::Observer implementation |
| 28 virtual void OnExtensionManagementSettingsChanged() OVERRIDE; | 32 virtual void OnExtensionManagementSettingsChanged() OVERRIDE; |
| 29 | 33 |
| 30 // Adds an extension to be updated to the pref dictionary. | 34 // Adds an extension to be updated to the pref dictionary. |
| 31 static void AddExtension(base::DictionaryValue* dict, | 35 static void AddExtension(base::DictionaryValue* dict, |
| 32 const std::string& extension_id, | 36 const std::string& extension_id, |
| 33 const std::string& update_url); | 37 const std::string& update_url); |
| 34 | 38 |
| 35 protected: | 39 protected: |
| 36 virtual void StartLoading() OVERRIDE; | 40 virtual void StartLoading() OVERRIDE; |
| 37 | 41 |
| 38 private: | 42 private: |
| 39 friend class base::RefCountedThreadSafe<ExternalLoader>; | 43 friend class base::RefCountedThreadSafe<ExternalLoader>; |
| 40 | 44 |
| 41 virtual ~ExternalPolicyLoader(); | 45 virtual ~ExternalPolicyLoader(); |
| 42 | 46 |
| 43 ExtensionManagement* settings_; | 47 ExtensionManagement* settings_; |
| 48 InstallationType type_; | |
| 44 | 49 |
| 45 DISALLOW_COPY_AND_ASSIGN(ExternalPolicyLoader); | 50 DISALLOW_COPY_AND_ASSIGN(ExternalPolicyLoader); |
| 46 }; | 51 }; |
| 47 | 52 |
| 48 } // namespace extensions | 53 } // namespace extensions |
| 49 | 54 |
| 50 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_ | 55 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_ |
| OLD | NEW |