OLD | NEW |
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/renderer/page_load_histograms.h" | 5 #include "chrome/renderer/page_load_histograms.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 base::UTF16ToUTF8(frame->dataSource()->response().httpHeaderField("Via")); | 171 base::UTF16ToUTF8(frame->dataSource()->response().httpHeaderField("Via")); |
172 | 172 |
173 if (via_header.empty()) | 173 if (via_header.empty()) |
174 return false; | 174 return false; |
175 std::string headers = "HTTP/1.1 200 OK\nVia: " + via_header + "\n\n"; | 175 std::string headers = "HTTP/1.1 200 OK\nVia: " + via_header + "\n\n"; |
176 // Produce raw headers, expected by the |HttpResponseHeaders| constructor. | 176 // Produce raw headers, expected by the |HttpResponseHeaders| constructor. |
177 std::replace(headers.begin(), headers.end(), '\n', '\0'); | 177 std::replace(headers.begin(), headers.end(), '\n', '\0'); |
178 scoped_refptr<net::HttpResponseHeaders> response_headers( | 178 scoped_refptr<net::HttpResponseHeaders> response_headers( |
179 new net::HttpResponseHeaders(headers)); | 179 new net::HttpResponseHeaders(headers)); |
180 return data_reduction_proxy::HasDataReductionProxyViaHeader( | 180 return data_reduction_proxy::HasDataReductionProxyViaHeader( |
181 response_headers, NULL); | 181 response_headers.get(), NULL); |
182 } | 182 } |
183 | 183 |
184 // Returns true if the provided URL is a referrer string that came from | 184 // Returns true if the provided URL is a referrer string that came from |
185 // a Google Web Search results page. This is a little non-deterministic | 185 // a Google Web Search results page. This is a little non-deterministic |
186 // because desktop and mobile websearch differ and sometimes just provide | 186 // because desktop and mobile websearch differ and sometimes just provide |
187 // http://www.google.com/ as the referrer. In the case of /url we can be sure | 187 // http://www.google.com/ as the referrer. In the case of /url we can be sure |
188 // that it came from websearch but we will be generous and allow for cases | 188 // that it came from websearch but we will be generous and allow for cases |
189 // where a non-Google URL was provided a bare Google URL as a referrer. | 189 // where a non-Google URL was provided a bare Google URL as a referrer. |
190 // The domain validation matches the code used by the prerenderer for similar | 190 // The domain validation matches the code used by the prerenderer for similar |
191 // purposes. | 191 // purposes. |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 | 757 |
758 DCHECK(document_state); | 758 DCHECK(document_state); |
759 DCHECK(ds); | 759 DCHECK(ds); |
760 GURL url(ds->request().url()); | 760 GURL url(ds->request().url()); |
761 Time start = document_state->start_load_time(); | 761 Time start = document_state->start_load_time(); |
762 Time finish = document_state->finish_load_time(); | 762 Time finish = document_state->finish_load_time(); |
763 // TODO(mbelshe): should we log more stats? | 763 // TODO(mbelshe): should we log more stats? |
764 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 764 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
765 << url.spec(); | 765 << url.spec(); |
766 } | 766 } |
OLD | NEW |