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

Unified Diff: google_apis/gcm/engine/gservices_settings.cc

Issue 1492913002: Add command line overrides for GCM checkin URL & MCS endpoint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review nit Created 5 years 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
« no previous file with comments | « google_apis/gcm/engine/gservices_settings.h ('k') | google_apis/gcm/engine/gservices_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gcm/engine/gservices_settings.cc
diff --git a/google_apis/gcm/engine/gservices_settings.cc b/google_apis/gcm/engine/gservices_settings.cc
index 6621ff88cc362d9ffead64eb293719ec83b1e894..1e3cf59670962a5e18ecb392d0b9b4d39f4b5b8d 100644
--- a/google_apis/gcm/engine/gservices_settings.cc
+++ b/google_apis/gcm/engine/gservices_settings.cc
@@ -178,11 +178,6 @@ const base::TimeDelta GServicesSettings::MinimumCheckinInterval() {
}
// static
-const GURL GServicesSettings::DefaultCheckinURL() {
- return GURL(kDefaultCheckinURL);
-}
-
-// static
std::string GServicesSettings::CalculateDigest(const SettingsMap& settings) {
unsigned char hash[base::kSHA1Length];
std::string data;
@@ -283,6 +278,10 @@ base::TimeDelta GServicesSettings::GetCheckinInterval() const {
}
GURL GServicesSettings::GetCheckinURL() const {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kGCMCheckinURL))
+ return GURL(command_line->GetSwitchValueASCII(switches::kGCMCheckinURL));
+
SettingsMap::const_iterator iter = settings_.find(kCheckinURLKey);
if (iter == settings_.end() || iter->second.empty())
return GURL(kDefaultCheckinURL);
@@ -290,6 +289,10 @@ GURL GServicesSettings::GetCheckinURL() const {
}
GURL GServicesSettings::GetMCSMainEndpoint() const {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kGCMMCSEndpoint))
+ return GURL(command_line->GetSwitchValueASCII(switches::kGCMMCSEndpoint));
+
// Get alternative hostname or use default.
std::string mcs_hostname;
SettingsMap::const_iterator iter = settings_.find(kMCSHostnameKey);
@@ -316,6 +319,10 @@ GURL GServicesSettings::GetMCSMainEndpoint() const {
}
GURL GServicesSettings::GetMCSFallbackEndpoint() const {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kGCMMCSEndpoint))
+ return GURL(); // No fallback endpoint when using command line override.
+
// Get alternative hostname or use default.
std::string mcs_hostname;
SettingsMap::const_iterator iter = settings_.find(kMCSHostnameKey);
@@ -335,15 +342,15 @@ GURL GServicesSettings::GetMCSFallbackEndpoint() const {
}
GURL GServicesSettings::GetRegistrationURL() const {
- SettingsMap::const_iterator iter = settings_.find(kRegistrationURLKey);
- if (iter == settings_.end() || iter->second.empty()) {
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- if (!command_line->HasSwitch(switches::kGCMRegistrationURL))
- return GURL(kDefaultRegistrationURL);
-
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kGCMRegistrationURL)) {
return GURL(
command_line->GetSwitchValueASCII(switches::kGCMRegistrationURL));
}
+
+ SettingsMap::const_iterator iter = settings_.find(kRegistrationURLKey);
+ if (iter == settings_.end() || iter->second.empty())
+ return GURL(kDefaultRegistrationURL);
return GURL(iter->second);
}
« no previous file with comments | « google_apis/gcm/engine/gservices_settings.h ('k') | google_apis/gcm/engine/gservices_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698