Make default apps cache multiprofile friendly
[chromium-blink-merge.git] / chrome / browser / extensions / external_policy_loader.h
blob700810e720ae16c96d21c8fda5c74707e87f5e48
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/prefs/pref_change_registrar.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"
16 class Profile;
18 namespace base {
19 class DictionaryValue;
22 namespace extensions {
24 // A specialization of the ExternalProvider that uses
25 // prefs::kExtensionInstallForceList to look up which external extensions are
26 // registered.
27 class ExternalPolicyLoader
28 : public ExternalLoader,
29 public content::NotificationObserver {
30 public:
31 explicit ExternalPolicyLoader(Profile* profile);
33 // content::NotificationObserver implementation
34 virtual void Observe(int type,
35 const content::NotificationSource& source,
36 const content::NotificationDetails& details) OVERRIDE;
38 // Adds an extension to be updated to the pref dictionary.
39 static void AddExtension(base::DictionaryValue* dict,
40 const std::string& extension_id,
41 const std::string& update_url);
43 protected:
44 virtual void StartLoading() OVERRIDE;
46 private:
47 friend class base::RefCountedThreadSafe<ExternalLoader>;
49 virtual ~ExternalPolicyLoader() {}
51 PrefChangeRegistrar pref_change_registrar_;
52 content::NotificationRegistrar notification_registrar_;
54 Profile* profile_;
56 DISALLOW_COPY_AND_ASSIGN(ExternalPolicyLoader);
59 } // namespace extensions
61 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_POLICY_LOADER_H_