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

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

Powered by Google App Engine
This is Rietveld 408576698