Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: chrome/browser/extensions/external_extension_provider_impl.h

Issue 10692168: Moved ExternalExtensionLoaders/Providers into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Even later master Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_IMPL_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_IMPL_H_
7
8 #include <string>
9
10 #include "chrome/browser/extensions/external_extension_provider_interface.h"
11
12 #include "base/memory/ref_counted.h"
13 #include "chrome/browser/extensions/external_extension_loader.h"
14
15 class ExternalExtensionLoader;
16 class Profile;
17 class Version;
18
19 namespace base {
20 class DictionaryValue;
21 }
22
23 namespace extensions {
24 class Extension;
25 }
26
27 // A specialization of the ExternalExtensionProvider that uses an instance
28 // of ExternalExtensionLoader to provide external extensions. This class
29 // can be seen as a bridge between the extension system and an
30 // ExternalExtensionLoader. Instances live their entire life on the UI thread.
31 class ExternalExtensionProviderImpl
32 : public ExternalExtensionProviderInterface {
33 public:
34 // The constructed provider will provide the extensions loaded from |loader|
35 // to |service|, that will deal with the installation. The location
36 // attributes of the provided extensions are also specified here:
37 // |crx_location|: extensions originating from crx files
38 // |download_location|: extensions originating from update URLs
39 // If either of the origins is not supported by this provider, then it should
40 // be initialized as Extensions::INVALID.
41 ExternalExtensionProviderImpl(
42 VisitorInterface* service,
43 ExternalExtensionLoader* loader,
44 extensions::Extension::Location crx_location,
45 extensions::Extension::Location download_location,
46 int creation_flags);
47
48 virtual ~ExternalExtensionProviderImpl();
49
50 // Populates a list with providers for all known sources.
51 static void CreateExternalProviders(
52 VisitorInterface* service,
53 Profile* profile,
54 ProviderCollection* provider_list);
55
56 // Sets underlying prefs and notifies provider. Only to be called by the
57 // owned ExternalExtensionLoader instance.
58 void SetPrefs(base::DictionaryValue* prefs);
59
60 // ExternalExtensionProvider implementation:
61 virtual void ServiceShutdown() OVERRIDE;
62 virtual void VisitRegisteredExtension() OVERRIDE;
63 virtual bool HasExtension(const std::string& id) const OVERRIDE;
64 virtual bool GetExtensionDetails(const std::string& id,
65 extensions::Extension::Location* location,
66 scoped_ptr<Version>* version) const OVERRIDE;
67
68 virtual bool IsReady() const OVERRIDE;
69
70 static const char kExternalCrx[];
71 static const char kExternalVersion[];
72 static const char kExternalUpdateUrl[];
73 static const char kSupportedLocales[];
74 static const char kIsBookmarkApp[];
75
76 void set_auto_acknowledge(bool auto_acknowledge) {
77 auto_acknowledge_ = auto_acknowledge;
78 }
79
80 private:
81 // Location for external extensions that are provided by this provider from
82 // local crx files.
83 const extensions::Extension::Location crx_location_;
84
85 // Location for external extensions that are provided by this provider from
86 // update URLs.
87 const extensions::Extension::Location download_location_;
88
89 // Weak pointer to the object that consumes the external extensions.
90 // This is zeroed out by: ServiceShutdown()
91 VisitorInterface* service_; // weak
92
93 // Dictionary of the external extensions that are provided by this provider.
94 scoped_ptr<base::DictionaryValue> prefs_;
95
96 // Indicates that the extensions provided by this provider are loaded
97 // entirely.
98 bool ready_;
99
100 // The loader that loads the list of external extensions and reports them
101 // via |SetPrefs|.
102 scoped_refptr<ExternalExtensionLoader> loader_;
103
104 // Creation flags to use for the extension. These flags will be used
105 // when calling Extenion::Create() by the crx installer.
106 int creation_flags_;
107
108 // Whether loaded extensions should be automatically acknowledged, so that
109 // the user doesn't see an alert about them.
110 bool auto_acknowledge_;
111
112 DISALLOW_COPY_AND_ASSIGN(ExternalExtensionProviderImpl);
113 };
114
115 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_extension_loader.cc ('k') | chrome/browser/extensions/external_extension_provider_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698