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

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

Issue 2768573002: Send traffic-management headers from extension updater. (Closed)
Patch Set: Rename on_demand_update to foreground_check. Created 3 years, 9 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/updater/manifest_fetch_data.cc
diff --git a/extensions/browser/updater/manifest_fetch_data.cc b/extensions/browser/updater/manifest_fetch_data.cc
index ed7626eaf694527af59b338a03ff49689b43f6d1..2e2e7141652ad94d7cc3d59de6050fb072d1c29d 100644
--- a/extensions/browser/updater/manifest_fetch_data.cc
+++ b/extensions/browser/updater/manifest_fetch_data.cc
@@ -41,11 +41,13 @@ ManifestFetchData::ManifestFetchData(const GURL& update_url,
int request_id,
const std::string& brand_code,
const std::string& base_query_params,
- PingMode ping_mode)
+ PingMode ping_mode,
+ bool foreground_check)
: base_url_(update_url),
full_url_(update_url),
brand_code_(brand_code),
- ping_mode_(ping_mode) {
+ ping_mode_(ping_mode),
+ foreground_check_(foreground_check) {
std::string query =
full_url_.has_query() ? full_url_.query() + "&" : std::string();
query += base_query_params;
@@ -85,12 +87,17 @@ bool ManifestFetchData::AddExtension(const std::string& id,
const std::string& version,
const PingData* ping_data,
const std::string& update_url_data,
- const std::string& install_source) {
+ const std::string& install_source,
+ bool foreground_check) {
if (extension_ids_.find(id) != extension_ids_.end()) {
NOTREACHED() << "Duplicate extension id " << id;
return false;
}
+ if (foreground_check != foreground_check_) {
+ return false;
Devlin 2017/03/24 15:14:47 It's a little worrisome to me that we just silentl
Minh X. Nguyen 2017/03/27 23:05:29 Done.
+ }
+
// Compute the string we'd append onto the full_url_, and see if it fits.
std::vector<std::string> parts;
parts.push_back("id=" + id);
@@ -173,6 +180,7 @@ bool ManifestFetchData::DidPing(const std::string& extension_id,
void ManifestFetchData::Merge(const ManifestFetchData& other) {
DCHECK(full_url() == other.full_url());
+ foreground_check_ |= other.foreground_check_;
Devlin 2017/03/24 15:14:47 can we add/modify a unittest for this?
Minh X. Nguyen 2017/03/27 23:05:29 Done.
request_ids_.insert(other.request_ids_.begin(), other.request_ids_.end());
}

Powered by Google App Engine
This is Rietveld 408576698