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 "base/prefs/pref_change_registrar.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 #include "content/public/browser/notification_observer.h" | |
| 14 #include "content/public/browser/notification_registrar.h" | |
| 15 | 13 |
| 16 class Profile; | 14 class Profile; |
| 17 | 15 |
| 18 namespace base { | 16 namespace base { |
| 19 class DictionaryValue; | 17 class DictionaryValue; |
| 20 } | 18 } |
| 21 | 19 |
| 22 namespace extensions { | 20 namespace extensions { |
| 23 | 21 |
| 24 // A specialization of the ExternalProvider that uses | 22 // A specialization of the ExternalProvider that uses extension management |
| 25 // pref_names::kInstallForceList to look up which external extensions are | 23 // policies to look up which external extensions are registered. |
| 26 // registered. | 24 class ExternalPolicyLoader : public ExternalLoader, |
| 27 class ExternalPolicyLoader | 25 public ExtensionManagement::Observer { |
| 28 : public ExternalLoader, | |
| 29 public content::NotificationObserver { | |
| 30 public: | 26 public: |
| 31 explicit ExternalPolicyLoader(Profile* profile); | 27 explicit ExternalPolicyLoader(Profile* profile); |
|
Joao da Silva
2014/09/04 12:07:46
This doesn't really need a Profile, just an Extens
binjin
2014/09/04 14:27:06
Done. But I don't know how to simplify the tests:
| |
| 32 | 28 |
| 33 // content::NotificationObserver implementation | 29 // ExtensionManagement::Observer implementation |
| 34 virtual void Observe(int type, | 30 virtual void OnExtensionManagementSettingsChanged() OVERRIDE; |
| 35 const content::NotificationSource& source, | |
| 36 const content::NotificationDetails& details) OVERRIDE; | |
| 37 | 31 |
| 38 // Adds an extension to be updated to the pref dictionary. | 32 // Adds an extension to be updated to the pref dictionary. |
| 39 static void AddExtension(base::DictionaryValue* dict, | 33 static void AddExtension(base::DictionaryValue* dict, |
| 40 const std::string& extension_id, | 34 const std::string& extension_id, |
| 41 const std::string& update_url); | 35 const std::string& update_url); |
| 42 | 36 |
| 43 protected: | 37 protected: |
| 44 virtual void StartLoading() OVERRIDE; | 38 virtual void StartLoading() OVERRIDE; |
| 45 | 39 |
| 46 private: | 40 private: |
| 47 friend class base::RefCountedThreadSafe<ExternalLoader>; | 41 friend class base::RefCountedThreadSafe<ExternalLoader>; |
| 48 | 42 |
| 49 virtual ~ExternalPolicyLoader() {} | 43 virtual ~ExternalPolicyLoader(); |
| 50 | 44 |
| 51 PrefChangeRegistrar pref_change_registrar_; | 45 ExtensionManagement* settings_; |
| 52 content::NotificationRegistrar notification_registrar_; | |
| 53 | |
| 54 Profile* profile_; | |
| 55 | 46 |
| 56 DISALLOW_COPY_AND_ASSIGN(ExternalPolicyLoader); | 47 DISALLOW_COPY_AND_ASSIGN(ExternalPolicyLoader); |
| 57 }; | 48 }; |
| 58 | 49 |
| 59 } // namespace extensions | 50 } // namespace extensions |
| 60 | 51 |
| 61 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_ | 52 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_ |
| OLD | NEW |