Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: chrome/browser/page_load_metrics/observers/previews_page_load_metrics_observer.cc

Issue 2699213002: Adding MHTML support into Page Load Metrics (Closed)
Patch Set: Only observe MHTML for previews observer Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/page_load_metrics/observers/previews_page_load_metrics_observer.cc
diff --git a/chrome/browser/page_load_metrics/observers/previews_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/previews_page_load_metrics_observer.cc
index 4b5b431d0629c7146668e8a856fa3e51ac45cfce..eba83de498a0fb1f1b506f1645e5c0f583a05fde 100644
--- a/chrome/browser/page_load_metrics/observers/previews_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/previews_page_load_metrics_observer.cc
@@ -4,8 +4,6 @@
#include "chrome/browser/page_load_metrics/observers/previews_page_load_metrics_observer.h"
-#include <string>
-
#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/page_load_metrics/page_load_metrics_util.h"
@@ -50,6 +48,17 @@ PreviewsPageLoadMetricsObserver::OnCommit(
: STOP_OBSERVING;
}
+page_load_metrics::PageLoadMetricsObserver::ObservePolicy
+PreviewsPageLoadMetricsObserver::ShouldObserveMimeType(
+ const std::string& mime_type) const {
+ // Support observing HTML, XHTML, and MHTML. Offline previews are served as
+ // MHTML (multipart/related).
+ return mime_type == "text/html" || mime_type == "application/xhtml+xml" ||
Bryan McQuade 2017/02/21 18:50:15 let's have this chain to the base class impl first
+ mime_type == "multipart/related"
+ ? CONTINUE_OBSERVING
+ : STOP_OBSERVING;
+}
+
void PreviewsPageLoadMetricsObserver::OnDomContentLoadedEventStart(
const page_load_metrics::PageLoadTiming& timing,
const page_load_metrics::PageLoadExtraInfo& info) {

Powered by Google App Engine
This is Rietveld 408576698