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

Side by Side Diff: google_apis/gcm/gcm_client_impl.cc

Issue 270403006: Adding handling of MCS Endpoints to GServicesSettings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing CR feedback 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "google_apis/gcm/gcm_client_impl.h" 5 #include "google_apis/gcm/gcm_client_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 }; 62 };
63 63
64 // Indicates a message type of the received message. 64 // Indicates a message type of the received message.
65 enum MessageType { 65 enum MessageType {
66 UNKNOWN, // Undetermined type. 66 UNKNOWN, // Undetermined type.
67 DATA_MESSAGE, // Regular data message. 67 DATA_MESSAGE, // Regular data message.
68 DELETED_MESSAGES, // Messages were deleted on the server. 68 DELETED_MESSAGES, // Messages were deleted on the server.
69 SEND_ERROR, // Error sending a message. 69 SEND_ERROR, // Error sending a message.
70 }; 70 };
71 71
72 // MCS endpoints. SSL Key pinning is done automatically due to the *.google.com
73 // pinning rule.
74 // Note: modifying the endpoints will affect the ability to compare the
75 // GCM.CurrentEnpoint histogram across versions.
76 const char kMCSEndpointMain[] = "https://mtalk.google.com:5228";
77 const char kMCSEndpointFallback[] = "https://mtalk.google.com:443";
78
79 const int kMaxRegistrationRetries = 5; 72 const int kMaxRegistrationRetries = 5;
80 const char kMessageTypeDataMessage[] = "gcm"; 73 const char kMessageTypeDataMessage[] = "gcm";
81 const char kMessageTypeDeletedMessagesKey[] = "deleted_messages"; 74 const char kMessageTypeDeletedMessagesKey[] = "deleted_messages";
82 const char kMessageTypeKey[] = "message_type"; 75 const char kMessageTypeKey[] = "message_type";
83 const char kMessageTypeSendErrorKey[] = "send_error"; 76 const char kMessageTypeSendErrorKey[] = "send_error";
84 const char kSendErrorMessageIdKey[] = "google.message_id"; 77 const char kSendErrorMessageIdKey[] = "google.message_id";
85 const char kSendMessageFromValue[] = "gcm@chrome.com"; 78 const char kSendMessageFromValue[] = "gcm@chrome.com";
86 const int64 kDefaultUserSerialNumber = 0LL; 79 const int64 kDefaultUserSerialNumber = 0LL;
87 80
88 GCMClient::Result ToGCMClientResult(MCSClient::MessageSendStatus status) { 81 GCMClient::Result ToGCMClientResult(MCSClient::MessageSendStatus status) {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 222 }
230 223
231 state_ = INITIAL_DEVICE_CHECKIN; 224 state_ = INITIAL_DEVICE_CHECKIN;
232 device_checkin_info_.Reset(); 225 device_checkin_info_.Reset();
233 StartCheckin(); 226 StartCheckin();
234 } 227 }
235 228
236 void GCMClientImpl::InitializeMCSClient( 229 void GCMClientImpl::InitializeMCSClient(
237 scoped_ptr<GCMStore::LoadResult> result) { 230 scoped_ptr<GCMStore::LoadResult> result) {
238 std::vector<GURL> endpoints; 231 std::vector<GURL> endpoints;
239 endpoints.push_back(GURL(kMCSEndpointMain)); 232 endpoints.push_back(gservices_settings_.mcs_main_endpoint());
240 endpoints.push_back(GURL(kMCSEndpointFallback)); 233 endpoints.push_back(gservices_settings_.mcs_fallback_endpoint());
241 connection_factory_ = internals_builder_->BuildConnectionFactory( 234 connection_factory_ = internals_builder_->BuildConnectionFactory(
242 endpoints, 235 endpoints,
243 kDefaultBackoffPolicy, 236 kDefaultBackoffPolicy,
244 network_session_, 237 network_session_,
245 net_log_.net_log(), 238 net_log_.net_log(),
246 &recorder_); 239 &recorder_);
247 mcs_client_ = internals_builder_->BuildMCSClient( 240 mcs_client_ = internals_builder_->BuildMCSClient(
248 chrome_build_proto_.chrome_version(), 241 chrome_build_proto_.chrome_version(),
249 clock_.get(), 242 clock_.get(),
250 connection_factory_.get(), 243 connection_factory_.get(),
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 757
765 recorder_.RecordIncomingSendError( 758 recorder_.RecordIncomingSendError(
766 data_message_stanza.category(), 759 data_message_stanza.category(),
767 data_message_stanza.to(), 760 data_message_stanza.to(),
768 data_message_stanza.id()); 761 data_message_stanza.id());
769 delegate_->OnMessageSendError(data_message_stanza.category(), 762 delegate_->OnMessageSendError(data_message_stanza.category(),
770 send_error_details); 763 send_error_details);
771 } 764 }
772 765
773 } // namespace gcm 766 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698