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

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

Issue 10554008: Move content::URLFetcher static functions to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win link error Created 8 years, 6 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
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/metrics/variations_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // side, but are not expected to be a significant problem. 140 // side, but are not expected to be a significant problem.
141 // 141 //
142 // 142 //
143 //------------------------------------------------------------------------------ 143 //------------------------------------------------------------------------------
144 144
145 #include "chrome/browser/metrics/metrics_service.h" 145 #include "chrome/browser/metrics/metrics_service.h"
146 146
147 #include <algorithm> 147 #include <algorithm>
148 148
149 #include "base/bind.h" 149 #include "base/bind.h"
150 #include "base/guid.h"
151 #include "base/callback.h" 150 #include "base/callback.h"
152 #include "base/command_line.h" 151 #include "base/command_line.h"
152 #include "base/guid.h"
153 #include "base/md5.h" 153 #include "base/md5.h"
154 #include "base/metrics/histogram.h" 154 #include "base/metrics/histogram.h"
155 #include "base/rand_util.h" 155 #include "base/rand_util.h"
156 #include "base/string_number_conversions.h" 156 #include "base/string_number_conversions.h"
157 #include "base/threading/platform_thread.h" 157 #include "base/threading/platform_thread.h"
158 #include "base/threading/thread.h" 158 #include "base/threading/thread.h"
159 #include "base/threading/thread_restrictions.h" 159 #include "base/threading/thread_restrictions.h"
160 #include "base/tracked_objects.h" 160 #include "base/tracked_objects.h"
161 #include "base/utf_string_conversions.h" 161 #include "base/utf_string_conversions.h"
162 #include "base/values.h" 162 #include "base/values.h"
(...skipping 21 matching lines...) Expand all
184 #include "chrome/common/chrome_switches.h" 184 #include "chrome/common/chrome_switches.h"
185 #include "chrome/common/metrics/metrics_log_manager.h" 185 #include "chrome/common/metrics/metrics_log_manager.h"
186 #include "chrome/common/net/test_server_locations.h" 186 #include "chrome/common/net/test_server_locations.h"
187 #include "chrome/common/pref_names.h" 187 #include "chrome/common/pref_names.h"
188 #include "chrome/common/render_messages.h" 188 #include "chrome/common/render_messages.h"
189 #include "content/public/browser/child_process_data.h" 189 #include "content/public/browser/child_process_data.h"
190 #include "content/public/browser/load_notification_details.h" 190 #include "content/public/browser/load_notification_details.h"
191 #include "content/public/browser/notification_service.h" 191 #include "content/public/browser/notification_service.h"
192 #include "content/public/browser/plugin_service.h" 192 #include "content/public/browser/plugin_service.h"
193 #include "content/public/browser/render_process_host.h" 193 #include "content/public/browser/render_process_host.h"
194 #include "content/public/common/url_fetcher.h"
195 #include "net/base/load_flags.h" 194 #include "net/base/load_flags.h"
195 #include "net/url_request/url_fetcher.h"
196 #include "webkit/plugins/webplugininfo.h" 196 #include "webkit/plugins/webplugininfo.h"
197 197
198 // TODO(port): port browser_distribution.h. 198 // TODO(port): port browser_distribution.h.
199 #if !defined(OS_POSIX) 199 #if !defined(OS_POSIX)
200 #include "chrome/installer/util/browser_distribution.h" 200 #include "chrome/installer/util/browser_distribution.h"
201 #endif 201 #endif
202 202
203 #if defined(OS_CHROMEOS) 203 #if defined(OS_CHROMEOS)
204 #include "chrome/browser/chromeos/cros/cros_library.h" 204 #include "chrome/browser/chromeos/cros/cros_library.h"
205 #include "chrome/browser/chromeos/external_metrics.h" 205 #include "chrome/browser/chromeos/external_metrics.h"
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 1284
1285 HandleIdleSinceLastTransmission(true); 1285 HandleIdleSinceLastTransmission(true);
1286 } 1286 }
1287 1287
1288 void MetricsService::PrepareFetchWithStagedLog() { 1288 void MetricsService::PrepareFetchWithStagedLog() {
1289 DCHECK(log_manager_.has_staged_log()); 1289 DCHECK(log_manager_.has_staged_log());
1290 1290
1291 // Prepare the XML version. 1291 // Prepare the XML version.
1292 DCHECK(!current_fetch_xml_.get()); 1292 DCHECK(!current_fetch_xml_.get());
1293 if (log_manager_.has_staged_log_xml()) { 1293 if (log_manager_.has_staged_log_xml()) {
1294 current_fetch_xml_.reset(content::URLFetcher::Create( 1294 current_fetch_xml_.reset(net::URLFetcher::Create(
1295 GURL(server_url_xml_), net::URLFetcher::POST, this)); 1295 GURL(server_url_xml_), net::URLFetcher::POST, this));
1296 current_fetch_xml_->SetRequestContext( 1296 current_fetch_xml_->SetRequestContext(
1297 g_browser_process->system_request_context()); 1297 g_browser_process->system_request_context());
1298 current_fetch_xml_->SetUploadData(kMimeTypeXml, 1298 current_fetch_xml_->SetUploadData(kMimeTypeXml,
1299 log_manager_.staged_log_text().xml); 1299 log_manager_.staged_log_text().xml);
1300 // We already drop cookies server-side, but we might as well strip them out 1300 // We already drop cookies server-side, but we might as well strip them out
1301 // client-side as well. 1301 // client-side as well.
1302 current_fetch_xml_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 1302 current_fetch_xml_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
1303 net::LOAD_DO_NOT_SEND_COOKIES); 1303 net::LOAD_DO_NOT_SEND_COOKIES);
1304 } 1304 }
1305 1305
1306 // Prepare the protobuf version. 1306 // Prepare the protobuf version.
1307 DCHECK(!current_fetch_proto_.get()); 1307 DCHECK(!current_fetch_proto_.get());
1308 if (log_manager_.has_staged_log_proto()) { 1308 if (log_manager_.has_staged_log_proto()) {
1309 current_fetch_proto_.reset(content::URLFetcher::Create( 1309 current_fetch_proto_.reset(net::URLFetcher::Create(
1310 GURL(server_url_proto_), net::URLFetcher::POST, this)); 1310 GURL(server_url_proto_), net::URLFetcher::POST, this));
1311 current_fetch_proto_->SetRequestContext( 1311 current_fetch_proto_->SetRequestContext(
1312 g_browser_process->system_request_context()); 1312 g_browser_process->system_request_context());
1313 current_fetch_proto_->SetUploadData(kMimeTypeProto, 1313 current_fetch_proto_->SetUploadData(kMimeTypeProto,
1314 log_manager_.staged_log_text().proto); 1314 log_manager_.staged_log_text().proto);
1315 // We already drop cookies server-side, but we might as well strip them out 1315 // We already drop cookies server-side, but we might as well strip them out
1316 // client-side as well. 1316 // client-side as well.
1317 current_fetch_proto_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 1317 current_fetch_proto_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
1318 net::LOAD_DO_NOT_SEND_COOKIES); 1318 net::LOAD_DO_NOT_SEND_COOKIES);
1319 } 1319 }
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 if (local_state) { 1825 if (local_state) {
1826 const PrefService::Preference* uma_pref = 1826 const PrefService::Preference* uma_pref =
1827 local_state->FindPreference(prefs::kMetricsReportingEnabled); 1827 local_state->FindPreference(prefs::kMetricsReportingEnabled);
1828 if (uma_pref) { 1828 if (uma_pref) {
1829 bool success = uma_pref->GetValue()->GetAsBoolean(&result); 1829 bool success = uma_pref->GetValue()->GetAsBoolean(&result);
1830 DCHECK(success); 1830 DCHECK(success);
1831 } 1831 }
1832 } 1832 }
1833 return result; 1833 return result;
1834 } 1834 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/metrics/variations_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698