Index: chrome/browser/extensions/external_extension_provider_impl.h |
=================================================================== |
--- chrome/browser/extensions/external_extension_provider_impl.h (revision 105797) |
+++ chrome/browser/extensions/external_extension_provider_impl.h (working copy) |
@@ -10,6 +10,8 @@ |
#include "base/memory/ref_counted.h" |
#include "chrome/browser/extensions/external_extension_loader.h" |
+#include "content/common/notification_observer.h" |
+#include "content/common/notification_registrar.h" |
class ExternalExtensionLoader; |
class Profile; |
@@ -50,7 +52,7 @@ |
// Sets underlying prefs and notifies provider. Only to be called by the |
// owned ExternalExtensionLoader instance. |
- void SetPrefs(base::DictionaryValue* prefs); |
+ virtual void SetPrefs(base::DictionaryValue* prefs); |
Mihai Parparita -not on Chrome
2011/10/19 07:31:36
I'm getting uncomfortable with the increased overr
Roger Tawa OOO till Jul 10th
2011/10/19 20:48:25
I could create a separate implementation of Extern
|
// ExternalExtensionProvider implementation: |
virtual void ServiceShutdown() OVERRIDE; |
@@ -69,9 +71,16 @@ |
static const char kExternalUpdateUrl[]; |
static const char kSupportedLocales[]; |
+ // Used only for testing. |
+ const std::set<std::string>& invalid_extensions() const { |
+ return invalid_extensions_; |
+ } |
+ |
protected: |
VisitorInterface* service() const { return service_; } |
+ base::DictionaryValue* prefs() const { return prefs_.get(); } |
+ |
private: |
// Location for external extensions that are provided by this provider from |
// local crx files. |
@@ -96,7 +105,57 @@ |
// via |SetPrefs|. |
scoped_refptr<ExternalExtensionLoader> loader_; |
+ // Extensions that were found to be invalid while processing the prefs_ |
+ // dictionary. These are extensions that this provider did not even attempt |
+ // to install because they failed one or more of the checks in SetPrefs(). |
+ // |
+ // TODO(mihai): It would be nice to simply remove these extensions from |
+ // prefs_, but for now, there is code that depends on these invalid extensions |
Mihai Parparita -not on Chrome
2011/10/19 07:31:36
What code are you referring to here?
Roger Tawa OOO till Jul 10th
2011/10/19 20:48:25
If you look at patch set #1 of this CL, I was addi
|
+ // still being available to HasExtension(). See how to fix this. |
+ std::set<std::string> invalid_extensions_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ExternalExtensionProviderImpl); |
}; |
+#if !defined(OS_CHROMEOS) |
+class DefaultAppsProvider : public ExternalExtensionProviderImpl, |
Mihai Parparita -not on Chrome
2011/10/19 07:31:36
Now that you're exposing this class in the header
Finnur
2011/10/19 10:01:29
+1
On 2011/10/19 07:31:36, Mihai Parparita wrote:
Roger Tawa OOO till Jul 10th
2011/10/19 20:48:25
Done.
Roger Tawa OOO till Jul 10th
2011/10/19 20:48:25
Done.
|
+ public NotificationObserver { |
+ public: |
+ DefaultAppsProvider(VisitorInterface* service, |
+ ExternalExtensionLoader* loader, |
+ Profile* profile); |
+ virtual ~DefaultAppsProvider(); |
+ |
+ // ExternalExtensionProviderImpl overrides: |
+ virtual void SetPrefs(base::DictionaryValue* prefs) OVERRIDE; |
+ virtual void ServiceShutdown() OVERRIDE; |
+ virtual void VisitRegisteredExtension() const OVERRIDE; |
+ |
+ // Implementation of NotificationObserver: |
+ virtual void Observe(int type, |
+ const NotificationSource& source, |
+ const NotificationDetails& details) OVERRIDE; |
+ |
+ // Used only for testing. |
+ const std::set<std::string>& install_error_extensions() const { |
+ return install_error_extensions_; |
+ } |
+ |
+ enum InstallState { |
Finnur
2011/10/19 10:01:29
Perhaps document that the values of these enums ar
Roger Tawa OOO till Jul 10th
2011/10/19 20:48:25
Done.
|
+ kInstallNotStarted, |
+ kInstalling, |
+ kInstallDone |
+ }; |
Finnur
2011/10/19 10:01:29
nit: enum should be at the top of the public secti
Roger Tawa OOO till Jul 10th
2011/10/19 20:48:25
Done.
|
+ |
+ private: |
+ Profile* profile_; |
+ NotificationRegistrar registrar_; |
+ |
+ // Set of extensions that failed to install for some reason. |
+ std::set<std::string> install_error_extensions_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DefaultAppsProvider); |
+}; |
+#endif |
+ |
#endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_IMPL_H_ |