| OLD | NEW |
| 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_PROVIDER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_IMPL_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_IMPL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_IMPL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_vector.h" |
| 13 #include "chrome/browser/extensions/external_loader.h" | 14 #include "chrome/browser/extensions/external_loader.h" |
| 14 #include "extensions/browser/external_provider_interface.h" | 15 #include "extensions/browser/external_provider_interface.h" |
| 15 #include "extensions/common/manifest.h" | 16 #include "extensions/common/manifest.h" |
| 16 | 17 |
| 17 class Profile; | 18 class Profile; |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class DictionaryValue; | 21 class DictionaryValue; |
| 21 class Version; | 22 class Version; |
| 22 } | 23 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 48 // Populates a list with providers for all known sources. | 49 // Populates a list with providers for all known sources. |
| 49 static void CreateExternalProviders( | 50 static void CreateExternalProviders( |
| 50 VisitorInterface* service, | 51 VisitorInterface* service, |
| 51 Profile* profile, | 52 Profile* profile, |
| 52 ProviderCollection* provider_list); | 53 ProviderCollection* provider_list); |
| 53 | 54 |
| 54 // 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 |
| 55 // owned ExternalLoader instance. | 56 // owned ExternalLoader instance. |
| 56 virtual void SetPrefs(base::DictionaryValue* prefs); | 57 virtual void SetPrefs(base::DictionaryValue* prefs); |
| 57 | 58 |
| 59 // Updates the underlying prefs and notifies provider. |
| 60 // Only to be called by the owned ExternalLoader instance. |
| 61 void UpdatePrefs(base::DictionaryValue* prefs); |
| 62 |
| 58 // ExternalProvider implementation: | 63 // ExternalProvider implementation: |
| 59 void ServiceShutdown() override; | 64 void ServiceShutdown() override; |
| 60 void VisitRegisteredExtension() override; | 65 void VisitRegisteredExtension() override; |
| 61 bool HasExtension(const std::string& id) const override; | 66 bool HasExtension(const std::string& id) const override; |
| 62 bool GetExtensionDetails(const std::string& id, | 67 bool GetExtensionDetails(const std::string& id, |
| 63 Manifest::Location* location, | 68 Manifest::Location* location, |
| 64 scoped_ptr<base::Version>* version) const override; | 69 scoped_ptr<base::Version>* version) const override; |
| 65 | 70 |
| 66 bool IsReady() const override; | 71 bool IsReady() const override; |
| 67 | 72 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 89 private: | 94 private: |
| 90 bool HandleMinProfileVersion(const base::DictionaryValue* extension, | 95 bool HandleMinProfileVersion(const base::DictionaryValue* extension, |
| 91 const std::string& extension_id, | 96 const std::string& extension_id, |
| 92 std::set<std::string>* unsupported_extensions); | 97 std::set<std::string>* unsupported_extensions); |
| 93 | 98 |
| 94 bool HandleDoNotInstallForEnterprise( | 99 bool HandleDoNotInstallForEnterprise( |
| 95 const base::DictionaryValue* extension, | 100 const base::DictionaryValue* extension, |
| 96 const std::string& extension_id, | 101 const std::string& extension_id, |
| 97 std::set<std::string>* unsupported_extensions); | 102 std::set<std::string>* unsupported_extensions); |
| 98 | 103 |
| 104 // Retrieves the extensions that were found in this provider. |
| 105 void RetrieveExtensionsFromPrefs( |
| 106 ScopedVector<ExternalInstallInfoUpdateUrl>* |
| 107 external_update_url_extensions, |
| 108 ScopedVector<ExternalInstallInfoFile>* external_file_extensions); |
| 109 |
| 99 // Location for external extensions that are provided by this provider from | 110 // Location for external extensions that are provided by this provider from |
| 100 // local crx files. | 111 // local crx files. |
| 101 const Manifest::Location crx_location_; | 112 const Manifest::Location crx_location_; |
| 102 | 113 |
| 103 // Location for external extensions that are provided by this provider from | 114 // Location for external extensions that are provided by this provider from |
| 104 // update URLs. | 115 // update URLs. |
| 105 const Manifest::Location download_location_; | 116 const Manifest::Location download_location_; |
| 106 | 117 |
| 107 // Weak pointer to the object that consumes the external extensions. | 118 // Weak pointer to the object that consumes the external extensions. |
| 108 // This is zeroed out by: ServiceShutdown() | 119 // This is zeroed out by: ServiceShutdown() |
| (...skipping 23 matching lines...) Expand all Loading... |
| 132 | 143 |
| 133 // Whether the extensions from this provider should be installed immediately. | 144 // Whether the extensions from this provider should be installed immediately. |
| 134 bool install_immediately_; | 145 bool install_immediately_; |
| 135 | 146 |
| 136 DISALLOW_COPY_AND_ASSIGN(ExternalProviderImpl); | 147 DISALLOW_COPY_AND_ASSIGN(ExternalProviderImpl); |
| 137 }; | 148 }; |
| 138 | 149 |
| 139 } // namespace extensions | 150 } // namespace extensions |
| 140 | 151 |
| 141 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_IMPL_H_ | 152 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_IMPL_H_ |
| OLD | NEW |