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

Side by Side Diff: chrome/browser/metrics/metrics_service.cc

Issue 10412050: Change most content::URLFetcher references to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS, address comments Created 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 //------------------------------------------------------------------------------ 5 //------------------------------------------------------------------------------
6 // Description of the life cycle of a instance of MetricsService. 6 // Description of the life cycle of a instance of MetricsService.
7 // 7 //
8 // OVERVIEW 8 // OVERVIEW
9 // 9 //
10 // A MetricsService instance is typically created at application startup. It 10 // A MetricsService instance is typically created at application startup. It
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // the log to the prefs for transmission during the next chrome session if this 234 // the log to the prefs for transmission during the next chrome session if this
235 // limit is exceeded. 235 // limit is exceeded.
236 const size_t kUploadLogAvoidRetransmitSize = 50000; 236 const size_t kUploadLogAvoidRetransmitSize = 50000;
237 237
238 // Interval, in minutes, between state saves. 238 // Interval, in minutes, between state saves.
239 const int kSaveStateIntervalMinutes = 5; 239 const int kSaveStateIntervalMinutes = 5;
240 240
241 // Used to indicate that the response code is currently not set at all -- 241 // Used to indicate that the response code is currently not set at all --
242 // RESPONSE_CODE_INVALID can sometimes be returned in response to a request if, 242 // RESPONSE_CODE_INVALID can sometimes be returned in response to a request if,
243 // e.g., the server is down. 243 // e.g., the server is down.
244 const int kNoResponseCode = content::URLFetcher::RESPONSE_CODE_INVALID - 1; 244 const int kNoResponseCode = net::URLFetcher::RESPONSE_CODE_INVALID - 1;
245 245
246 enum ResponseStatus { 246 enum ResponseStatus {
247 UNKNOWN_FAILURE, 247 UNKNOWN_FAILURE,
248 SUCCESS, 248 SUCCESS,
249 BAD_REQUEST, // Invalid syntax or log too large. 249 BAD_REQUEST, // Invalid syntax or log too large.
250 NUM_RESPONSE_STATUSES 250 NUM_RESPONSE_STATUSES
251 }; 251 };
252 252
253 ResponseStatus ResponseCodeToStatus(int response_code) { 253 ResponseStatus ResponseCodeToStatus(int response_code) {
254 switch (response_code) { 254 switch (response_code) {
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 1177
1178 HandleIdleSinceLastTransmission(true); 1178 HandleIdleSinceLastTransmission(true);
1179 } 1179 }
1180 1180
1181 void MetricsService::PrepareFetchWithStagedLog() { 1181 void MetricsService::PrepareFetchWithStagedLog() {
1182 DCHECK(!log_manager_.staged_log_text().empty()); 1182 DCHECK(!log_manager_.staged_log_text().empty());
1183 1183
1184 // Prepare the XML version. 1184 // Prepare the XML version.
1185 DCHECK(!current_fetch_xml_.get()); 1185 DCHECK(!current_fetch_xml_.get());
1186 current_fetch_xml_.reset(content::URLFetcher::Create( 1186 current_fetch_xml_.reset(content::URLFetcher::Create(
1187 GURL(server_url_xml_), content::URLFetcher::POST, this)); 1187 GURL(server_url_xml_), net::URLFetcher::POST, this));
1188 current_fetch_xml_->SetRequestContext( 1188 current_fetch_xml_->SetRequestContext(
1189 g_browser_process->system_request_context()); 1189 g_browser_process->system_request_context());
1190 current_fetch_xml_->SetUploadData(kMimeTypeXml, 1190 current_fetch_xml_->SetUploadData(kMimeTypeXml,
1191 log_manager_.staged_log_text().xml); 1191 log_manager_.staged_log_text().xml);
1192 // We already drop cookies server-side, but we might as well strip them out 1192 // We already drop cookies server-side, but we might as well strip them out
1193 // client-side as well. 1193 // client-side as well.
1194 current_fetch_xml_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 1194 current_fetch_xml_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
1195 net::LOAD_DO_NOT_SEND_COOKIES); 1195 net::LOAD_DO_NOT_SEND_COOKIES);
1196 1196
1197 // Prepare the protobuf version. 1197 // Prepare the protobuf version.
1198 DCHECK(!current_fetch_proto_.get()); 1198 DCHECK(!current_fetch_proto_.get());
1199 if (log_manager_.has_staged_log_proto()) { 1199 if (log_manager_.has_staged_log_proto()) {
1200 current_fetch_proto_.reset(content::URLFetcher::Create( 1200 current_fetch_proto_.reset(content::URLFetcher::Create(
1201 GURL(server_url_proto_), content::URLFetcher::POST, this)); 1201 GURL(server_url_proto_), net::URLFetcher::POST, this));
1202 current_fetch_proto_->SetRequestContext( 1202 current_fetch_proto_->SetRequestContext(
1203 g_browser_process->system_request_context()); 1203 g_browser_process->system_request_context());
1204 current_fetch_proto_->SetUploadData(kMimeTypeProto, 1204 current_fetch_proto_->SetUploadData(kMimeTypeProto,
1205 log_manager_.staged_log_text().proto); 1205 log_manager_.staged_log_text().proto);
1206 // We already drop cookies server-side, but we might as well strip them out 1206 // We already drop cookies server-side, but we might as well strip them out
1207 // client-side as well. 1207 // client-side as well.
1208 current_fetch_proto_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 1208 current_fetch_proto_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
1209 net::LOAD_DO_NOT_SEND_COOKIES); 1209 net::LOAD_DO_NOT_SEND_COOKIES);
1210 1210
1211 // Discard the protobuf version of the staged log, so that we will avoid 1211 // Discard the protobuf version of the staged log, so that we will avoid
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 if (local_state) { 1766 if (local_state) {
1767 const PrefService::Preference* uma_pref = 1767 const PrefService::Preference* uma_pref =
1768 local_state->FindPreference(prefs::kMetricsReportingEnabled); 1768 local_state->FindPreference(prefs::kMetricsReportingEnabled);
1769 if (uma_pref) { 1769 if (uma_pref) {
1770 bool success = uma_pref->GetValue()->GetAsBoolean(&result); 1770 bool success = uma_pref->GetValue()->GetAsBoolean(&result);
1771 DCHECK(success); 1771 DCHECK(success);
1772 } 1772 }
1773 } 1773 }
1774 return result; 1774 return result;
1775 } 1775 }
OLDNEW
« no previous file with comments | « chrome/browser/intranet_redirect_detector.cc ('k') | chrome/browser/net/gaia/gaia_oauth_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698