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

Unified Diff: chrome/browser/extensions/updater/manifest_fetch_data.cc

Issue 10689097: Enforce the 'requirements' field in manifests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 6 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: chrome/browser/extensions/updater/manifest_fetch_data.cc
diff --git a/chrome/browser/extensions/updater/manifest_fetch_data.cc b/chrome/browser/extensions/updater/manifest_fetch_data.cc
index a5f8dda9b4b05c7564c07e1baf787555b39108f7..b8d3a7008549b20598bde34b2bad8af3985fc019 100644
--- a/chrome/browser/extensions/updater/manifest_fetch_data.cc
+++ b/chrome/browser/extensions/updater/manifest_fetch_data.cc
@@ -23,6 +23,29 @@ const int kExtensionsManifestMaxURLSize = 2000;
namespace extensions {
+ManifestFetchExtensionInfo::ManifestFetchExtensionInfo(
+ const std::string& id, const std::string& version,
+ const std::string& update_url_data, const std::string& install_source,
+ bool is_sync)
+ : id(id),
+ version(version),
+ update_url_data(update_url_data),
+ install_source(install_source),
+ is_sync(is_sync) {
+}
+
+ManifestFetchExtensionInfo::ManifestFetchExtensionInfo()
+ : id(""),
+ version(""),
+ update_url_data(""),
+ install_source(""),
+ is_sync(false) {
+}
+
+ManifestFetchExtensionInfo::~ManifestFetchExtensionInfo() {
+}
+
+
ManifestFetchData::ManifestFetchData(const GURL& update_url)
: base_url_(update_url),
full_url_(update_url) {
@@ -55,8 +78,9 @@ ManifestFetchData::~ManifestFetchData() {}
bool ManifestFetchData::AddExtension(std::string id, std::string version,
const PingData* ping_data,
const std::string& update_url_data,
- const std::string& install_source) {
- if (extension_ids_.find(id) != extension_ids_.end()) {
+ const std::string& install_source,
+ const bool is_sync) {
+ if (extension_infos_.find(id) != extension_infos_.end()) {
NOTREACHED() << "Duplicate extension id " << id;
return false;
}
@@ -111,20 +135,23 @@ bool ManifestFetchData::AddExtension(std::string id, std::string version,
// Check against our max url size, exempting the first extension added.
int new_size = full_url_.possibly_invalid_spec().size() + extra.size();
- if (!extension_ids_.empty() && new_size > kExtensionsManifestMaxURLSize) {
+ if (!extension_infos_.empty() && new_size > kExtensionsManifestMaxURLSize) {
UMA_HISTOGRAM_PERCENTAGE("Extensions.UpdateCheckHitUrlSizeLimit", 1);
return false;
}
UMA_HISTOGRAM_PERCENTAGE("Extensions.UpdateCheckHitUrlSizeLimit", 0);
// We have room so go ahead and add the extension.
- extension_ids_.insert(id);
+ extension_infos_[id] = ManifestFetchExtensionInfo(id, version,
+ update_url_data,
+ install_source,
+ is_sync);
full_url_ = GURL(full_url_.possibly_invalid_spec() + extra);
return true;
}
bool ManifestFetchData::Includes(const std::string& extension_id) const {
- return extension_ids_.find(extension_id) != extension_ids_.end();
+ return extension_infos_.find(extension_id) != extension_infos_.end();
}
bool ManifestFetchData::DidPing(std::string extension_id, PingType type) const {

Powered by Google App Engine
This is Rietveld 408576698