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

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

Issue 10392192: Remove content::URLFetcherDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 #include "chrome/browser/metrics/variations_service.h" 5 #include "chrome/browser/metrics/variations_service.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/build_time.h" 8 #include "base/build_time.h"
9 #include "base/version.h"
10 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
11 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/version.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/metrics/proto/trials_seed.pb.h" 13 #include "chrome/browser/metrics/proto/trials_seed.pb.h"
14 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
16 #include "content/public/common/url_fetcher.h" 16 #include "content/public/common/url_fetcher.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 #include "net/base/load_flags.h" 18 #include "net/base/load_flags.h"
19 #include "net/base/network_change_notifier.h" 19 #include "net/base/network_change_notifier.h"
20 #include "net/url_request/url_request_status.h" 20 #include "net/url_request/url_request_status.h"
21 21
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 net::LOAD_DO_NOT_SAVE_COOKIES); 76 net::LOAD_DO_NOT_SAVE_COOKIES);
77 pending_seed_request_->SetRequestContext( 77 pending_seed_request_->SetRequestContext(
78 g_browser_process->system_request_context()); 78 g_browser_process->system_request_context());
79 pending_seed_request_->SetMaxRetries(kMaxRetrySeedFetch); 79 pending_seed_request_->SetMaxRetries(kMaxRetrySeedFetch);
80 pending_seed_request_->Start(); 80 pending_seed_request_->Start();
81 } 81 }
82 82
83 void VariationsService::OnURLFetchComplete(const net::URLFetcher* source) { 83 void VariationsService::OnURLFetchComplete(const net::URLFetcher* source) {
84 DCHECK_EQ(pending_seed_request_.get(), source); 84 DCHECK_EQ(pending_seed_request_.get(), source);
85 // When we're done handling the request, the fetcher will be deleted. 85 // When we're done handling the request, the fetcher will be deleted.
86 scoped_ptr<const content::URLFetcher> request( 86 scoped_ptr<const net::URLFetcher> request(
87 pending_seed_request_.release()); 87 pending_seed_request_.release());
88 if (request->GetStatus().status() != net::URLRequestStatus::SUCCESS || 88 if (request->GetStatus().status() != net::URLRequestStatus::SUCCESS ||
89 request->GetResponseCode() != 200) 89 request->GetResponseCode() != 200)
90 return; 90 return;
91 91
92 std::string seed_data; 92 std::string seed_data;
93 request->GetResponseAsString(&seed_data); 93 request->GetResponseAsString(&seed_data);
94 94
95 StoreSeedData(seed_data, g_browser_process->local_state()); 95 StoreSeedData(seed_data, g_browser_process->local_state());
96 } 96 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 for (int i = 0; i < study.experiment_size(); ++i) { 272 for (int i = 0; i < study.experiment_size(); ++i) {
273 if (study.experiment(i).name() != default_group_name) { 273 if (study.experiment(i).name() != default_group_name) {
274 trial->AppendGroup(study.experiment(i).name(), 274 trial->AppendGroup(study.experiment(i).name(),
275 study.experiment(i).probability_weight()); 275 study.experiment(i).probability_weight());
276 } 276 }
277 } 277 }
278 278
279 // TODO(jwd): Add experiment_id association code. 279 // TODO(jwd): Add experiment_id association code.
280 trial->SetForced(); 280 trial->SetForced();
281 } 281 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698