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

Side by Side Diff: net/proxy/proxy_service.cc

Issue 12209080: Cleanup: Remove deprecated base::Value methods from net. Use base::Value too. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | « net/proxy/proxy_config.cc ('k') | net/socket/client_socket_pool_base.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 #include "net/proxy/proxy_service.h" 5 #include "net/proxy/proxy_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 const scoped_refptr<ProxyResolverScriptData>& /*script_data*/, 202 const scoped_refptr<ProxyResolverScriptData>& /*script_data*/,
203 const CompletionCallback& /*callback*/) OVERRIDE { 203 const CompletionCallback& /*callback*/) OVERRIDE {
204 return ERR_NOT_IMPLEMENTED; 204 return ERR_NOT_IMPLEMENTED;
205 } 205 }
206 }; 206 };
207 207
208 // ProxyResolver that simulates a PAC script which returns 208 // ProxyResolver that simulates a PAC script which returns
209 // |pac_string| for every single URL. 209 // |pac_string| for every single URL.
210 class ProxyResolverFromPacString : public ProxyResolver { 210 class ProxyResolverFromPacString : public ProxyResolver {
211 public: 211 public:
212 ProxyResolverFromPacString(const std::string& pac_string) 212 explicit ProxyResolverFromPacString(const std::string& pac_string)
213 : ProxyResolver(false /*expects_pac_bytes*/), 213 : ProxyResolver(false /*expects_pac_bytes*/),
214 pac_string_(pac_string) {} 214 pac_string_(pac_string) {}
215 215
216 virtual int GetProxyForURL(const GURL& url, 216 virtual int GetProxyForURL(const GURL& url,
217 ProxyInfo* results, 217 ProxyInfo* results,
218 const CompletionCallback& callback, 218 const CompletionCallback& callback,
219 RequestHandle* request, 219 RequestHandle* request,
220 const BoundNetLog& net_log) OVERRIDE { 220 const BoundNetLog& net_log) OVERRIDE {
221 results->UsePacString(pac_string_); 221 results->UsePacString(pac_string_);
222 return OK; 222 return OK;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 static bool IsSupported() { 266 static bool IsSupported() {
267 #if defined(OS_WIN) || defined(OS_MACOSX) 267 #if defined(OS_WIN) || defined(OS_MACOSX)
268 return true; 268 return true;
269 #else 269 #else
270 return false; 270 return false;
271 #endif 271 #endif
272 } 272 }
273 }; 273 };
274 274
275 // Returns NetLog parameters describing a proxy configuration change. 275 // Returns NetLog parameters describing a proxy configuration change.
276 Value* NetLogProxyConfigChangedCallback(const ProxyConfig* old_config, 276 base::Value* NetLogProxyConfigChangedCallback(
277 const ProxyConfig* new_config, 277 const ProxyConfig* old_config,
278 NetLog::LogLevel /* log_level */) { 278 const ProxyConfig* new_config,
279 DictionaryValue* dict = new DictionaryValue(); 279 NetLog::LogLevel /* log_level */) {
280 base::DictionaryValue* dict = new base::DictionaryValue();
280 // The "old_config" is optional -- the first notification will not have 281 // The "old_config" is optional -- the first notification will not have
281 // any "previous" configuration. 282 // any "previous" configuration.
282 if (old_config->is_valid()) 283 if (old_config->is_valid())
283 dict->Set("old_config", old_config->ToValue()); 284 dict->Set("old_config", old_config->ToValue());
284 dict->Set("new_config", new_config->ToValue()); 285 dict->Set("new_config", new_config->ToValue());
285 return dict; 286 return dict;
286 } 287 }
287 288
288 Value* NetLogBadProxyListCallback(const ProxyRetryInfoMap* retry_info, 289 base::Value* NetLogBadProxyListCallback(const ProxyRetryInfoMap* retry_info,
289 NetLog::LogLevel /* log_level */) { 290 NetLog::LogLevel /* log_level */) {
290 DictionaryValue* dict = new DictionaryValue(); 291 base::DictionaryValue* dict = new base::DictionaryValue();
291 ListValue* list = new ListValue(); 292 base::ListValue* list = new base::ListValue();
292 293
293 for (ProxyRetryInfoMap::const_iterator iter = retry_info->begin(); 294 for (ProxyRetryInfoMap::const_iterator iter = retry_info->begin();
294 iter != retry_info->end(); ++iter) { 295 iter != retry_info->end(); ++iter) {
295 list->Append(Value::CreateStringValue(iter->first)); 296 list->Append(new base::StringValue(iter->first));
296 } 297 }
297 dict->Set("bad_proxy_list", list); 298 dict->Set("bad_proxy_list", list);
298 return dict; 299 return dict;
299 } 300 }
300 301
301 // Returns NetLog parameters on a successfuly proxy resolution. 302 // Returns NetLog parameters on a successfuly proxy resolution.
302 Value* NetLogFinishedResolvingProxyCallback(ProxyInfo* result, 303 base::Value* NetLogFinishedResolvingProxyCallback(
303 NetLog::LogLevel /* log_level */) { 304 ProxyInfo* result,
304 DictionaryValue* dict = new DictionaryValue(); 305 NetLog::LogLevel /* log_level */) {
306 base::DictionaryValue* dict = new base::DictionaryValue();
305 dict->SetString("pac_string", result->ToPacString()); 307 dict->SetString("pac_string", result->ToPacString());
306 return dict; 308 return dict;
307 } 309 }
308 310
309 #if defined(OS_CHROMEOS) 311 #if defined(OS_CHROMEOS)
310 class UnsetProxyConfigService : public ProxyConfigService { 312 class UnsetProxyConfigService : public ProxyConfigService {
311 public: 313 public:
312 UnsetProxyConfigService() {} 314 UnsetProxyConfigService() {}
313 virtual ~UnsetProxyConfigService() {} 315 virtual ~UnsetProxyConfigService() {}
314 316
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 friend class base::RefCounted<ProxyService::PacRequest>; 830 friend class base::RefCounted<ProxyService::PacRequest>;
829 831
830 ~PacRequest() {} 832 ~PacRequest() {}
831 833
832 // Callback for when the ProxyResolver request has completed. 834 // Callback for when the ProxyResolver request has completed.
833 void QueryComplete(int result_code) { 835 void QueryComplete(int result_code) {
834 result_code = QueryDidComplete(result_code); 836 result_code = QueryDidComplete(result_code);
835 837
836 // Remove this completed PacRequest from the service's pending list. 838 // Remove this completed PacRequest from the service's pending list.
837 /// (which will probably cause deletion of |this|). 839 /// (which will probably cause deletion of |this|).
838 if (!user_callback_.is_null()){ 840 if (!user_callback_.is_null()) {
839 net::CompletionCallback callback = user_callback_; 841 net::CompletionCallback callback = user_callback_;
840 service_->RemovePendingRequest(this); 842 service_->RemovePendingRequest(this);
841 callback.Run(result_code); 843 callback.Run(result_code);
842 } 844 }
843 } 845 }
844 846
845 ProxyResolver* resolver() const { return service_->resolver_.get(); } 847 ProxyResolver* resolver() const { return service_->resolver_.get(); }
846 848
847 // Note that we don't hold a reference to the ProxyService. Outstanding 849 // Note that we don't hold a reference to the ProxyService. Outstanding
848 // requests are cancelled during ~ProxyService, so this is guaranteed 850 // requests are cancelled during ~ProxyService, so this is guaranteed
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 OnCompletion(result_); 1567 OnCompletion(result_);
1566 } 1568 }
1567 } 1569 }
1568 1570
1569 void SyncProxyServiceHelper::OnCompletion(int rv) { 1571 void SyncProxyServiceHelper::OnCompletion(int rv) {
1570 result_ = rv; 1572 result_ = rv;
1571 event_.Signal(); 1573 event_.Signal();
1572 } 1574 }
1573 1575
1574 } // namespace net 1576 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_config.cc ('k') | net/socket/client_socket_pool_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698