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

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

Powered by Google App Engine
This is Rietveld 408576698