| 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 | 88 |
| 92 // Ignore non-HTML documents (e.g. SVG). Note that images are treated by | 89 // 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 | 90 // Blink as HTML documents, so to exclude images, we must perform |
| 94 // additional mime type checking below. | 91 // additional mime type checking below. |
| 95 if (!document.isHTMLDocument() && !document.isXHTMLDocument()) | 92 if (!document.isHTMLDocument() && !document.isXHTMLDocument()) |
| 96 return false; | 93 return false; |
| 97 | 94 |
| 98 // Ignore non-HTML mime types (e.g. images). | 95 // Ignore non-HTML mime types (e.g. images). |
| 99 std::string mime_type = url_response.mimeType().utf8(); | 96 std::string mime_type = url_response.mimeType().utf8(); |
| 100 if (mime_type != "text/html" && mime_type != "application/xhtml+xml") | 97 if (mime_type != "text/html" && mime_type != "application/xhtml+xml") |
| (...skipping 26 matching lines...) Expand all Loading... |
| 127 return make_scoped_ptr(new base::OneShotTimer); | 124 return make_scoped_ptr(new base::OneShotTimer); |
| 128 } | 125 } |
| 129 | 126 |
| 130 bool MetricsRenderFrameObserver::HasNoRenderFrame() const { | 127 bool MetricsRenderFrameObserver::HasNoRenderFrame() const { |
| 131 bool no_frame = !render_frame() || !render_frame()->GetWebFrame(); | 128 bool no_frame = !render_frame() || !render_frame()->GetWebFrame(); |
| 132 DCHECK(!no_frame); | 129 DCHECK(!no_frame); |
| 133 return no_frame; | 130 return no_frame; |
| 134 } | 131 } |
| 135 | 132 |
| 136 } // namespace page_load_metrics | 133 } // namespace page_load_metrics |
| OLD | NEW |