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