| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef GOOGLE_APIS_GCM_ENGINE_GSERVICES_SETTINGS_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_GSERVICES_SETTINGS_H_ |
| 6 #define GOOGLE_APIS_GCM_ENGINE_GSERVICES_SETTINGS_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_GSERVICES_SETTINGS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 // Gets the settings as a map of string to string for storing. | 41 // Gets the settings as a map of string to string for storing. |
| 42 std::map<std::string, std::string> GetSettingsMap() const; | 42 std::map<std::string, std::string> GetSettingsMap() const; |
| 43 | 43 |
| 44 std::string digest() const { return digest_; } | 44 std::string digest() const { return digest_; } |
| 45 | 45 |
| 46 base::TimeDelta checkin_interval() const { return checkin_interval_; } | 46 base::TimeDelta checkin_interval() const { return checkin_interval_; } |
| 47 | 47 |
| 48 GURL checkin_url() const { return checkin_url_; } | 48 GURL checkin_url() const { return checkin_url_; } |
| 49 | 49 |
| 50 // TODO(fgorski): Consider returning GURL and use it for validation. | 50 GURL mcs_main_endpoint() const { return mcs_main_endpoint_; } |
| 51 std::string mcs_hostname() const { return mcs_hostname_; } | |
| 52 | 51 |
| 53 int mcs_secure_port() const { return mcs_secure_port_; } | 52 GURL mcs_fallback_endpoint() const { return mcs_fallback_endpoint_; } |
| 54 | 53 |
| 55 GURL registration_url() const { return registration_url_; } | 54 GURL registration_url() const { return registration_url_; } |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 // Parses the |settings| to fill in specific fields. | 57 // Parses the |settings| to fill in specific fields. |
| 59 // TODO(fgorski): Change to a status variable that can be logged to UMA. | 58 // TODO(fgorski): Change to a status variable that can be logged to UMA. |
| 60 bool UpdateSettings(const std::map<std::string, std::string>& settings); | 59 bool UpdateSettings(const std::map<std::string, std::string>& settings); |
| 61 | 60 |
| 62 // Digest (hash) of the settings, used to check whether settings need update. | 61 // Digest (hash) of the settings, used to check whether settings need update. |
| 63 // It is meant to be sent with checkin request, instead of sending the whole | 62 // It is meant to be sent with checkin request, instead of sending the whole |
| 64 // settings table. | 63 // settings table. |
| 65 std::string digest_; | 64 std::string digest_; |
| 66 | 65 |
| 67 // Time delta between periodic checkins. | 66 // Time delta between periodic checkins. |
| 68 base::TimeDelta checkin_interval_; | 67 base::TimeDelta checkin_interval_; |
| 69 | 68 |
| 70 // URL that should be used for checkins. | 69 // URL that should be used for checkins. |
| 71 GURL checkin_url_; | 70 GURL checkin_url_; |
| 72 | 71 |
| 73 // Hostname of the MCS server. | 72 // Main MCS endpoint. |
| 74 std::string mcs_hostname_; | 73 GURL mcs_main_endpoint_; |
| 75 | 74 |
| 76 // Secure port to connect to on MCS sever. | 75 // Fallback MCS endpoint. |
| 77 int mcs_secure_port_; | 76 GURL mcs_fallback_endpoint_; |
| 78 | 77 |
| 79 // URL that should be used for regisrations and unregistrations. | 78 // URL that should be used for regisrations and unregistrations. |
| 80 GURL registration_url_; | 79 GURL registration_url_; |
| 81 | 80 |
| 82 // Factory for creating references in callbacks. | 81 // Factory for creating references in callbacks. |
| 83 base::WeakPtrFactory<GServicesSettings> weak_ptr_factory_; | 82 base::WeakPtrFactory<GServicesSettings> weak_ptr_factory_; |
| 84 | 83 |
| 85 DISALLOW_COPY_AND_ASSIGN(GServicesSettings); | 84 DISALLOW_COPY_AND_ASSIGN(GServicesSettings); |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 } // namespace gcm | 87 } // namespace gcm |
| 89 | 88 |
| 90 #endif // GOOGLE_APIS_GCM_ENGINE_GSERVICES_SETTINGS_H_ | 89 #endif // GOOGLE_APIS_GCM_ENGINE_GSERVICES_SETTINGS_H_ |
| OLD | NEW |