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