| 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 "chrome/browser/extensions/external_loader.h" | 8 #include "chrome/browser/extensions/external_loader.h" |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/prefs/public/pref_change_registrar.h" | 11 #include "base/prefs/public/pref_change_registrar.h" |
| 12 #include "base/prefs/public/pref_observer.h" |
| 12 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 14 | 15 |
| 15 class Profile; | 16 class Profile; |
| 16 | 17 |
| 17 namespace extensions { | 18 namespace extensions { |
| 18 | 19 |
| 19 // A specialization of the ExternalProvider that uses | 20 // A specialization of the ExternalProvider that uses |
| 20 // prefs::kExtensionInstallForceList to look up which external extensions are | 21 // prefs::kExtensionInstallForceList to look up which external extensions are |
| 21 // registered. | 22 // registered. |
| 22 class ExternalPolicyLoader | 23 class ExternalPolicyLoader |
| 23 : public ExternalLoader, | 24 : public ExternalLoader, |
| 24 public content::NotificationObserver { | 25 public content::NotificationObserver, |
| 26 public PrefObserver { |
| 25 public: | 27 public: |
| 26 explicit ExternalPolicyLoader(Profile* profile); | 28 explicit ExternalPolicyLoader(Profile* profile); |
| 27 | 29 |
| 28 // content::NotificationObserver implementation | 30 // content::NotificationObserver implementation |
| 29 virtual void Observe(int type, | 31 virtual void Observe(int type, |
| 30 const content::NotificationSource& source, | 32 const content::NotificationSource& source, |
| 31 const content::NotificationDetails& details) OVERRIDE; | 33 const content::NotificationDetails& details) OVERRIDE; |
| 32 | 34 |
| 35 // PrefObserver implementation |
| 36 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 37 const std::string& pref_name) OVERRIDE; |
| 38 |
| 33 protected: | 39 protected: |
| 34 virtual void StartLoading() OVERRIDE; | 40 virtual void StartLoading() OVERRIDE; |
| 35 | 41 |
| 36 private: | 42 private: |
| 37 friend class base::RefCountedThreadSafe<ExternalLoader>; | 43 friend class base::RefCountedThreadSafe<ExternalLoader>; |
| 38 | 44 |
| 39 virtual ~ExternalPolicyLoader() {} | 45 virtual ~ExternalPolicyLoader() {} |
| 40 | 46 |
| 41 PrefChangeRegistrar pref_change_registrar_; | 47 PrefChangeRegistrar pref_change_registrar_; |
| 42 content::NotificationRegistrar notification_registrar_; | 48 content::NotificationRegistrar notification_registrar_; |
| 43 | 49 |
| 44 Profile* profile_; | 50 Profile* profile_; |
| 45 | 51 |
| 46 DISALLOW_COPY_AND_ASSIGN(ExternalPolicyLoader); | 52 DISALLOW_COPY_AND_ASSIGN(ExternalPolicyLoader); |
| 47 }; | 53 }; |
| 48 | 54 |
| 49 } // namespace extensions | 55 } // namespace extensions |
| 50 | 56 |
| 51 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_ | 57 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_ |
| OLD | NEW |