OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/net/spdyproxy/proxy_advisor.h" | 5 #include "chrome/browser/net/spdyproxy/proxy_advisor.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 bool is_preconnect) { | 110 bool is_preconnect) { |
111 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 111 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
112 | 112 |
113 if (!WouldProxyURL(url)) | 113 if (!WouldProxyURL(url)) |
114 return; | 114 return; |
115 | 115 |
116 std::string motivation_name(MotivationName(motivation, is_preconnect)); | 116 std::string motivation_name(MotivationName(motivation, is_preconnect)); |
117 std::string header_value = motivation_name + " " + url.spec(); | 117 std::string header_value = motivation_name + " " + url.spec(); |
118 net::URLRequestContext* context = context_getter_->GetURLRequestContext(); | 118 net::URLRequestContext* context = context_getter_->GetURLRequestContext(); |
119 std::string endpoint = | 119 std::string endpoint = |
120 DataReductionProxySettings::GetDataReductionProxyOrigin(); | 120 DataReductionProxySettings::GetDataReductionProxyOrigin() + "preconnect"; |
121 endpoint += "/preconnect"; | |
122 scoped_ptr<net::URLRequest> request = context->CreateRequest( | 121 scoped_ptr<net::URLRequest> request = context->CreateRequest( |
123 GURL(endpoint), net::DEFAULT_PRIORITY, this); | 122 GURL(endpoint), net::DEFAULT_PRIORITY, this); |
124 request->set_method("HEAD"); | 123 request->set_method("HEAD"); |
125 request->SetExtraRequestHeaderByName( | 124 request->SetExtraRequestHeaderByName( |
126 "Proxy-Host-Advisory", header_value, false); | 125 "Proxy-Host-Advisory", header_value, false); |
127 request->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 126 request->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
128 net::LOAD_DO_NOT_SAVE_COOKIES | | 127 net::LOAD_DO_NOT_SAVE_COOKIES | |
129 net::LOAD_BYPASS_PROXY | | 128 net::LOAD_BYPASS_PROXY | |
130 net::LOAD_DISABLE_CACHE); | 129 net::LOAD_DISABLE_CACHE); |
131 net::URLRequest* raw_request = request.get(); | 130 net::URLRequest* raw_request = request.get(); |
(...skipping 19 matching lines...) Expand all Loading... |
151 scoped_ptr<net::URLRequest> scoped_request_for_deletion(request); | 150 scoped_ptr<net::URLRequest> scoped_request_for_deletion(request); |
152 inflight_requests_.erase(request); | 151 inflight_requests_.erase(request); |
153 // |scoped_request_for_deletion| will delete |request| | 152 // |scoped_request_for_deletion| will delete |request| |
154 } | 153 } |
155 | 154 |
156 void ProxyAdvisor::UpdateProxyState() { | 155 void ProxyAdvisor::UpdateProxyState() { |
157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
158 // Delete all inflight requests. Each request's destructor will call Cancel(). | 157 // Delete all inflight requests. Each request's destructor will call Cancel(). |
159 STLDeleteElements(&inflight_requests_); | 158 STLDeleteElements(&inflight_requests_); |
160 } | 159 } |
OLD | NEW |