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

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

Issue 288433002: G-services settings v3 implementation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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: google_apis/gcm/engine/gservices_settings.h
diff --git a/google_apis/gcm/engine/gservices_settings.h b/google_apis/gcm/engine/gservices_settings.h
index 7961ca278447a374505b4ccebd5effb21329ebbe..c2411a5b71352fa2f37488974e0b50273dbb694e 100644
--- a/google_apis/gcm/engine/gservices_settings.h
+++ b/google_apis/gcm/engine/gservices_settings.h
@@ -21,12 +21,16 @@ namespace gcm {
// extracting them from checkin response and storing in GCMStore.
class GCM_EXPORT GServicesSettings {
public:
+ typedef std::map<std::string, std::string> SettingsMap;
jianli 2014/05/13 21:41:52 nit: empty line
fgorski 2014/05/13 23:53:28 Done.
// Minimum periodic checkin interval in seconds.
static const base::TimeDelta MinimumCheckinInterval();
// Default checkin URL.
static const GURL DefaultCheckinURL();
+ // Calculates digest of provided settings.
+ static std::string CalculateDigest(const SettingsMap& settings);
+
GServicesSettings();
~GServicesSettings();
@@ -39,44 +43,48 @@ class GCM_EXPORT GServicesSettings {
void UpdateFromLoadResult(const GCMStore::LoadResult& load_result);
// Gets the settings as a map of string to string for storing.
- std::map<std::string, std::string> GetSettingsMap() const;
+ SettingsMap GetSettingsMap() const;
std::string digest() const { return digest_; }
- base::TimeDelta checkin_interval() const { return checkin_interval_; }
+ // Gets the interval at which device should perform a checkin.
+ base::TimeDelta checkin_interval() const;
jianli 2014/05/13 21:41:52 Since now we provide more complicated implementati
fgorski 2014/05/13 23:53:28 Done. Applied that to all settings, as they all ha
- GURL checkin_url() const { return checkin_url_; }
+ // Gets a URL to use when checkin in.
+ GURL checkin_url() const;
- GURL mcs_main_endpoint() const { return mcs_main_endpoint_; }
+ // Gets address of main MCS endpoint.
+ GURL mcs_main_endpoint() const;
- GURL mcs_fallback_endpoint() const { return mcs_fallback_endpoint_; }
+ // Gets address of fallback MCS endpoint.
+ GURL mcs_fallback_endpoint() const;
- GURL registration_url() const { return registration_url_; }
+ // Gets a URL to use when registering or unregistering the apps.
+ GURL registration_url() const;
private:
// Parses the |settings| to fill in specific fields.
// TODO(fgorski): Change to a status variable that can be logged to UMA.
- bool UpdateSettings(const std::map<std::string, std::string>& settings);
+ bool UpdateSettings(const SettingsMap& settings);
+
+ // Functions to verify correctnes of newly proposed settings.
+ bool VerifySettings(const SettingsMap& settings) const;
+ bool VerifyCheckinInterval(const SettingsMap& settings) const;
+ bool VerifyCheckinURL(const SettingsMap& settings) const;
+ bool VerifyMCSEndpoint(const SettingsMap& settings) const;
+ bool VerifyRegistrationURL(const SettingsMap& settings) const;
+
+ // Settings digest verification.
+ bool VerifyDigest(const SettingsMap& settings,
+ const std::string& expected_digest) const;
// Digest (hash) of the settings, used to check whether settings need update.
// It is meant to be sent with checkin request, instead of sending the whole
// settings table.
std::string digest_;
- // Time delta between periodic checkins.
- base::TimeDelta checkin_interval_;
-
- // URL that should be used for checkins.
- GURL checkin_url_;
-
- // Main MCS endpoint.
- GURL mcs_main_endpoint_;
-
- // Fallback MCS endpoint.
- GURL mcs_fallback_endpoint_;
-
- // URL that should be used for regisrations and unregistrations.
- GURL registration_url_;
+ // G-services settings as provided by checkin response.
+ SettingsMap settings_;
// Factory for creating references in callbacks.
base::WeakPtrFactory<GServicesSettings> weak_ptr_factory_;
« no previous file with comments | « no previous file | google_apis/gcm/engine/gservices_settings.cc » ('j') | google_apis/gcm/engine/gservices_settings.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698