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

Unified Diff: extensions/browser/external_provider_interface.h

Issue 1495403002: Observe adding external extensions via windows registry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: guard updater_->CheckNow() call, rework Provider->ExtensionService interaction Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/external_provider_interface.h
diff --git a/extensions/browser/external_provider_interface.h b/extensions/browser/external_provider_interface.h
index 801f4ede5640de99259898da3c2b0e22cbb9e336..0b184511095fb80559dca6ac5dce99ee0d9335ae 100644
--- a/extensions/browser/external_provider_interface.h
+++ b/extensions/browser/external_provider_interface.h
@@ -8,13 +8,16 @@
#include <vector>
#include "base/memory/linked_ptr.h"
+#include "base/memory/scoped_vector.h"
+#include "base/version.h"
#include "extensions/common/manifest.h"
+#include "url/gurl.h"
class GURL;
namespace base {
class FilePath;
-class Version;
+// class Version;
}
namespace extensions {
@@ -23,6 +26,66 @@ namespace extensions {
// providers.
class ExternalProviderInterface {
public:
+ struct ExternalExtensionInfo {
lazyboy 2016/01/22 07:52:41 These structs basically hold the information from
asargent_no_longer_on_chrome 2016/01/25 18:50:52 Acknowledged.
+ std::string extension_id;
+ int creation_flags;
+ bool mark_acknowledged;
+ ExternalExtensionInfo(const std::string& extension_id,
+ int creation_flags,
+ bool mark_acknowledged)
+ : extension_id(extension_id),
+ creation_flags(creation_flags),
+ mark_acknowledged(mark_acknowledged) {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ExternalExtensionInfo);
+ };
+
+ // Carries information about an external extension installation
+ // through a crx file location.
+ struct FileExtensionInfo : ExternalExtensionInfo {
+ FileExtensionInfo(const std::string& extension_id,
+ scoped_ptr<base::Version> version,
+ const base::FilePath& path,
+ Manifest::Location crx_location,
+ bool mark_acknowledged,
+ int creation_flags,
+ bool install_immediately)
+ : ExternalExtensionInfo(extension_id,
+ creation_flags,
+ mark_acknowledged),
+ version(std::move(version)),
+ path(path),
+ crx_location(crx_location),
+ install_immediately(install_immediately) {}
+
+ scoped_ptr<base::Version> version;
+ base::FilePath path;
+ Manifest::Location crx_location;
+ bool install_immediately;
+ };
+
+ // Carries information about an external extension installation
+ // through an update_url.
+ struct UpdateUrlExtensionInfo : ExternalExtensionInfo {
+ UpdateUrlExtensionInfo(const std::string& extension_id,
+ const std::string& install_parameter,
+ scoped_ptr<GURL> update_url,
+ Manifest::Location download_location,
+ int creation_flags,
+ bool mark_acknowledged)
+ : ExternalExtensionInfo(extension_id,
+ creation_flags,
+ mark_acknowledged),
+ install_parameter(install_parameter),
+ update_url(std::move(update_url)),
+ download_location(download_location) {}
+
+ std::string install_parameter;
+ scoped_ptr<GURL> update_url;
+ Manifest::Location download_location;
+ };
+
// ExternalProvider uses this interface to communicate back to the
// caller what extensions are registered, and which |id|, |version| and |path|
// they have. See also VisitRegisteredExtension below. Ownership of |version|
@@ -34,25 +97,13 @@ class ExternalProviderInterface {
// Return true if the extension install will proceed. Install will not
// proceed if the extension is already installed from a higher priority
// location.
- virtual bool OnExternalExtensionFileFound(
- const std::string& id,
- const base::Version* version,
- const base::FilePath& path,
- Manifest::Location location,
- int creation_flags,
- bool mark_acknowledged,
- bool install_immediately) = 0;
+ virtual bool OnExternalExtensionFileFound(FileExtensionInfo* info) = 0;
// Return true if the extension install will proceed. Install might not
// proceed if the extension is already installed from a higher priority
// location.
- virtual bool OnExternalExtensionUpdateUrlFound(
- const std::string& id,
- const std::string& install_parameter,
- const GURL& update_url,
- Manifest::Location location,
- int creation_flags,
- bool mark_acknowledged) = 0;
+ virtual bool OnExternalExtensionUpdateUrlFound(UpdateUrlExtensionInfo* info,
+ bool is_initial_load) = 0;
// Called after all the external extensions have been reported
// through the above two methods. |provider| is a pointer to the
@@ -62,6 +113,17 @@ class ExternalProviderInterface {
virtual void OnExternalProviderReady(
const ExternalProviderInterface* provider) = 0;
+ // Once this provider becomes "ready", it can send additional external
+ // extensions it learns about later on through
+ // OnExternalExtensionUpdateUrlFound() or OnExternalExtensionFileFound().
+ // This method will be called each time the provider finds a set of
+ // updated external extensions.
+ virtual void OnExternalProviderUpdateComplete(
+ const ExternalProviderInterface* provider,
+ const ScopedVector<UpdateUrlExtensionInfo>& update_url_extensions,
+ const ScopedVector<FileExtensionInfo>& file_extensions,
+ const std::set<std::string>& removed_extensions) = 0;
+
protected:
virtual ~VisitorInterface() {}
};

Powered by Google App Engine
This is Rietveld 408576698