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

Side by Side Diff: content/browser/resolve_proxy_msg_helper.cc

Issue 7711010: Removal of Profile from content part 9 of 9. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missing mock Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/resolve_proxy_msg_helper.h" 5 #include "content/browser/resolve_proxy_msg_helper.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "content/browser/content_browser_client.h"
9 #include "content/common/child_process_messages.h" 9 #include "content/common/child_process_messages.h"
10 #include "content/common/content_client.h"
10 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
11 #include "net/url_request/url_request_context.h" 12 #include "net/url_request/url_request_context.h"
12 #include "net/url_request/url_request_context_getter.h" 13 #include "net/url_request/url_request_context_getter.h"
13 14
14 ResolveProxyMsgHelper::ResolveProxyMsgHelper(net::ProxyService* proxy_service) 15 ResolveProxyMsgHelper::ResolveProxyMsgHelper(net::ProxyService* proxy_service)
15 : proxy_service_(NULL), 16 : proxy_service_(NULL),
16 ALLOW_THIS_IN_INITIALIZER_LIST(callback_( 17 ALLOW_THIS_IN_INITIALIZER_LIST(callback_(
17 this, &ResolveProxyMsgHelper::OnResolveProxyCompleted)), 18 this, &ResolveProxyMsgHelper::OnResolveProxyCompleted)),
18 proxy_service_override_(proxy_service) { 19 proxy_service_override_(proxy_service) {
19 } 20 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 84 }
84 85
85 bool ResolveProxyMsgHelper::GetProxyService(net::ProxyService** out) const { 86 bool ResolveProxyMsgHelper::GetProxyService(net::ProxyService** out) const {
86 // Unit-tests specify their own proxy service to use. 87 // Unit-tests specify their own proxy service to use.
87 if (proxy_service_override_) { 88 if (proxy_service_override_) {
88 *out = proxy_service_override_; 89 *out = proxy_service_override_;
89 return true; 90 return true;
90 } 91 }
91 92
92 // If there is no default request context (say during shut down). 93 // If there is no default request context (say during shut down).
94 // Deprecated; see http://crbug.com/92361
93 net::URLRequestContextGetter* context_getter = 95 net::URLRequestContextGetter* context_getter =
94 Profile::Deprecated::GetDefaultRequestContext(); 96 content::GetContentClient()->browser()->
97 GetDefaultRequestContextDeprecatedCrBug64339();
95 if (!context_getter) 98 if (!context_getter)
96 return false; 99 return false;
97 100
98 // Otherwise use the browser's global proxy service. 101 // Otherwise use the browser's global proxy service.
99 *out = context_getter->GetURLRequestContext()->proxy_service(); 102 *out = context_getter->GetURLRequestContext()->proxy_service();
100 return true; 103 return true;
101 } 104 }
102 105
103 ResolveProxyMsgHelper::~ResolveProxyMsgHelper() { 106 ResolveProxyMsgHelper::~ResolveProxyMsgHelper() {
104 // Clear all pending requests if the ProxyService is still alive (if we have a 107 // Clear all pending requests if the ProxyService is still alive (if we have a
105 // default request context or override). 108 // default request context or override).
109 // Deprecated; see http://crbug.com/92361
110 net::URLRequestContextGetter* context_getter =
111 content::GetContentClient()->browser()->
112 GetDefaultRequestContextDeprecatedCrBug64339();
106 if (!pending_requests_.empty() && 113 if (!pending_requests_.empty() &&
107 (Profile::Deprecated::GetDefaultRequestContext() || 114 (context_getter || proxy_service_override_)) {
108 proxy_service_override_)) {
109 PendingRequest req = pending_requests_.front(); 115 PendingRequest req = pending_requests_.front();
110 proxy_service_->CancelPacRequest(req.pac_req); 116 proxy_service_->CancelPacRequest(req.pac_req);
111 } 117 }
112 118
113 for (PendingRequestList::iterator it = pending_requests_.begin(); 119 for (PendingRequestList::iterator it = pending_requests_.begin();
114 it != pending_requests_.end(); 120 it != pending_requests_.end();
115 ++it) { 121 ++it) {
116 delete it->reply_msg; 122 delete it->reply_msg;
117 } 123 }
118 124
119 proxy_service_ = NULL; 125 proxy_service_ = NULL;
120 pending_requests_.clear(); 126 pending_requests_.clear();
121 } 127 }
OLDNEW
« no previous file with comments | « content/browser/mock_content_browser_client.cc ('k') | content/browser/speech/speech_recognizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698