OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/page_load_metrics/renderer/metrics_render_frame_observer.h" | 5 #include "components/page_load_metrics/renderer/metrics_render_frame_observer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 if (frame->parent()) | 80 if (frame->parent()) |
81 return false; | 81 return false; |
82 | 82 |
83 const blink::WebDocument& document = frame->document(); | 83 const blink::WebDocument& document = frame->document(); |
84 // Ignore non-HTTP schemes (e.g. chrome://). | 84 // Ignore non-HTTP schemes (e.g. chrome://). |
85 const GURL& url = document.url(); | 85 const GURL& url = document.url(); |
86 if (!url.SchemeIsHTTPOrHTTPS()) | 86 if (!url.SchemeIsHTTPOrHTTPS()) |
87 return false; | 87 return false; |
88 | 88 |
89 const blink::WebURLResponse& url_response = frame->dataSource()->response(); | 89 const blink::WebURLResponse& url_response = frame->dataSource()->response(); |
90 // Ignore multipart responses (e.g. MHTML). | |
91 if (url_response.isMultipartPayload()) | |
92 return false; | |
93 | 90 |
94 // Ignore non-HTML documents (e.g. SVG). Note that images are treated by | 91 // Ignore non-HTML documents (e.g. SVG). Note that images are treated by |
95 // Blink as HTML documents, so to exclude images, we must perform | 92 // Blink as HTML documents, so to exclude images, we must perform |
96 // additional mime type checking below. | 93 // additional mime type checking below. |
97 if (!document.isHTMLDocument() && !document.isXHTMLDocument()) | 94 if (!document.isHTMLDocument() && !document.isXHTMLDocument()) |
98 return false; | 95 return false; |
99 | 96 |
100 // Ignore non-HTML mime types (e.g. images). | 97 // Ignore non-HTML mime types (e.g. images). |
101 std::string mime_type = url_response.mimeType().utf8(); | 98 std::string mime_type = url_response.mimeType().utf8(); |
102 if (mime_type != "text/html" && mime_type != "application/xhtml+xml") | 99 if (mime_type != "text/html" && mime_type != "application/xhtml+xml") |
(...skipping 27 matching lines...) Expand all Loading... |
130 return make_scoped_ptr(new base::OneShotTimer); | 127 return make_scoped_ptr(new base::OneShotTimer); |
131 } | 128 } |
132 | 129 |
133 bool MetricsRenderFrameObserver::HasNoRenderFrame() const { | 130 bool MetricsRenderFrameObserver::HasNoRenderFrame() const { |
134 bool no_frame = !render_frame() || !render_frame()->GetWebFrame(); | 131 bool no_frame = !render_frame() || !render_frame()->GetWebFrame(); |
135 DCHECK(!no_frame); | 132 DCHECK(!no_frame); |
136 return no_frame; | 133 return no_frame; |
137 } | 134 } |
138 | 135 |
139 } // namespace page_load_metrics | 136 } // namespace page_load_metrics |
OLD | NEW |