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

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

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

Powered by Google App Engine
This is Rietveld 408576698