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 #include "components/gcm_driver/gcm_channel_status_request.h" | 5 #include "components/gcm_driver/gcm_channel_status_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "components/gcm_driver/gcm_backoff_policy.h" | 9 #include "components/gcm_driver/gcm_backoff_policy.h" |
10 #include "net/base/escape.h" | 10 #include "net/base/escape.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 GURL request_url(channel_status_request_url_); | 58 GURL request_url(channel_status_request_url_); |
59 | 59 |
60 sync_pb::ExperimentStatusRequest proto_data; | 60 sync_pb::ExperimentStatusRequest proto_data; |
61 proto_data.add_experiment_name(kGCMChannelTag); | 61 proto_data.add_experiment_name(kGCMChannelTag); |
62 std::string upload_data; | 62 std::string upload_data; |
63 if (!proto_data.SerializeToString(&upload_data)) { | 63 if (!proto_data.SerializeToString(&upload_data)) { |
64 NOTREACHED(); | 64 NOTREACHED(); |
65 } | 65 } |
66 | 66 |
67 url_fetcher_.reset( | 67 url_fetcher_ = |
68 net::URLFetcher::Create(request_url, net::URLFetcher::POST, this)); | 68 net::URLFetcher::Create(request_url, net::URLFetcher::POST, this); |
69 url_fetcher_->SetRequestContext(request_context_getter_.get()); | 69 url_fetcher_->SetRequestContext(request_context_getter_.get()); |
70 url_fetcher_->AddExtraRequestHeader("User-Agent: " + user_agent_); | 70 url_fetcher_->AddExtraRequestHeader("User-Agent: " + user_agent_); |
71 url_fetcher_->SetUploadData(kRequestContentType, upload_data); | 71 url_fetcher_->SetUploadData(kRequestContentType, upload_data); |
72 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 72 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
73 net::LOAD_DO_NOT_SAVE_COOKIES); | 73 net::LOAD_DO_NOT_SAVE_COOKIES); |
74 url_fetcher_->Start(); | 74 url_fetcher_->Start(); |
75 } | 75 } |
76 | 76 |
77 void GCMChannelStatusRequest::OnURLFetchComplete( | 77 void GCMChannelStatusRequest::OnURLFetchComplete( |
78 const net::URLFetcher* source) { | 78 const net::URLFetcher* source) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 weak_ptr_factory_.GetWeakPtr(), | 148 weak_ptr_factory_.GetWeakPtr(), |
149 false), | 149 false), |
150 backoff_entry_.GetTimeUntilRelease()); | 150 backoff_entry_.GetTimeUntilRelease()); |
151 return; | 151 return; |
152 } | 152 } |
153 | 153 |
154 Start(); | 154 Start(); |
155 } | 155 } |
156 | 156 |
157 } // namespace gcm | 157 } // namespace gcm |
OLD | NEW |