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

Side by Side Diff: chrome/browser/autofill/autofill_download.cc

Issue 10956034: Switching from ForXyz naming to FromXyz naming, for consistency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head Created 8 years, 3 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/autofill/autofill_download.h" 5 #include "chrome/browser/autofill/autofill_download.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream> 8 #include <ostream>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 Observer* observer) 51 Observer* observer)
52 : browser_context_(context), 52 : browser_context_(context),
53 observer_(observer), 53 observer_(observer),
54 max_form_cache_size_(kMaxFormCacheSize), 54 max_form_cache_size_(kMaxFormCacheSize),
55 next_query_request_(base::Time::Now()), 55 next_query_request_(base::Time::Now()),
56 next_upload_request_(base::Time::Now()), 56 next_upload_request_(base::Time::Now()),
57 positive_upload_rate_(0), 57 positive_upload_rate_(0),
58 negative_upload_rate_(0), 58 negative_upload_rate_(0),
59 fetcher_id_for_unittest_(0) { 59 fetcher_id_for_unittest_(0) {
60 DCHECK(observer_); 60 DCHECK(observer_);
61 PrefServiceBase* preferences = PrefServiceBase::ForContext(browser_context_); 61 PrefServiceBase* preferences =
62 PrefServiceBase::FromBrowserContext(browser_context_);
62 positive_upload_rate_ = 63 positive_upload_rate_ =
63 preferences->GetDouble(prefs::kAutofillPositiveUploadRate); 64 preferences->GetDouble(prefs::kAutofillPositiveUploadRate);
64 negative_upload_rate_ = 65 negative_upload_rate_ =
65 preferences->GetDouble(prefs::kAutofillNegativeUploadRate); 66 preferences->GetDouble(prefs::kAutofillNegativeUploadRate);
66 } 67 }
67 68
68 AutofillDownloadManager::~AutofillDownloadManager() { 69 AutofillDownloadManager::~AutofillDownloadManager() {
69 STLDeleteContainerPairFirstPointers(url_fetchers_.begin(), 70 STLDeleteContainerPairFirstPointers(url_fetchers_.begin(),
70 url_fetchers_.end()); 71 url_fetchers_.end());
71 } 72 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 double AutofillDownloadManager::GetNegativeUploadRate() const { 139 double AutofillDownloadManager::GetNegativeUploadRate() const {
139 return negative_upload_rate_; 140 return negative_upload_rate_;
140 } 141 }
141 142
142 void AutofillDownloadManager::SetPositiveUploadRate(double rate) { 143 void AutofillDownloadManager::SetPositiveUploadRate(double rate) {
143 if (rate == positive_upload_rate_) 144 if (rate == positive_upload_rate_)
144 return; 145 return;
145 positive_upload_rate_ = rate; 146 positive_upload_rate_ = rate;
146 DCHECK_GE(rate, 0.0); 147 DCHECK_GE(rate, 0.0);
147 DCHECK_LE(rate, 1.0); 148 DCHECK_LE(rate, 1.0);
148 PrefServiceBase* preferences = PrefServiceBase::ForContext(browser_context_); 149 PrefServiceBase* preferences = PrefServiceBase::FromBrowserContext(
150 browser_context_);
149 preferences->SetDouble(prefs::kAutofillPositiveUploadRate, rate); 151 preferences->SetDouble(prefs::kAutofillPositiveUploadRate, rate);
150 } 152 }
151 153
152 void AutofillDownloadManager::SetNegativeUploadRate(double rate) { 154 void AutofillDownloadManager::SetNegativeUploadRate(double rate) {
153 if (rate == negative_upload_rate_) 155 if (rate == negative_upload_rate_)
154 return; 156 return;
155 negative_upload_rate_ = rate; 157 negative_upload_rate_ = rate;
156 DCHECK_GE(rate, 0.0); 158 DCHECK_GE(rate, 0.0);
157 DCHECK_LE(rate, 1.0); 159 DCHECK_LE(rate, 1.0);
158 PrefServiceBase* preferences = PrefServiceBase::ForContext(browser_context_); 160 PrefServiceBase* preferences = PrefServiceBase::FromBrowserContext(
161 browser_context_);
159 preferences->SetDouble(prefs::kAutofillNegativeUploadRate, rate); 162 preferences->SetDouble(prefs::kAutofillNegativeUploadRate, rate);
160 } 163 }
161 164
162 bool AutofillDownloadManager::StartRequest( 165 bool AutofillDownloadManager::StartRequest(
163 const std::string& form_xml, 166 const std::string& form_xml,
164 const FormRequestData& request_data) { 167 const FormRequestData& request_data) {
165 net::URLRequestContextGetter* request_context = 168 net::URLRequestContextGetter* request_context =
166 browser_context_->GetRequestContext(); 169 browser_context_->GetRequestContext();
167 DCHECK(request_context); 170 DCHECK(request_context);
168 std::string request_url; 171 std::string request_url;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 SetPositiveUploadRate(new_positive_upload_rate); 315 SetPositiveUploadRate(new_positive_upload_rate);
313 SetNegativeUploadRate(new_negative_upload_rate); 316 SetNegativeUploadRate(new_negative_upload_rate);
314 } 317 }
315 318
316 observer_->OnUploadedPossibleFieldTypes(); 319 observer_->OnUploadedPossibleFieldTypes();
317 } 320 }
318 } 321 }
319 delete it->first; 322 delete it->first;
320 url_fetchers_.erase(it); 323 url_fetchers_.erase(it);
321 } 324 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_common_test.cc ('k') | chrome/browser/autofill/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698