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

Side by Side Diff: chrome/browser/page_load_metrics/page_load_metrics_initialize.cc

Issue 2901383002: Buffer cross frame paint timing updates. (Closed)
Patch Set: factor WeakMockTimer into a common location. Created 3 years, 6 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 unified diff | Download patch
OLDNEW
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 "chrome/browser/page_load_metrics/page_load_metrics_initialize.h" 5 #include "chrome/browser/page_load_metrics/page_load_metrics_initialize.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" 9 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h"
10 #if defined(OS_ANDROID) 10 #if defined(OS_ANDROID)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 class PageLoadMetricsEmbedder 49 class PageLoadMetricsEmbedder
50 : public page_load_metrics::PageLoadMetricsEmbedderInterface { 50 : public page_load_metrics::PageLoadMetricsEmbedderInterface {
51 public: 51 public:
52 explicit PageLoadMetricsEmbedder(content::WebContents* web_contents); 52 explicit PageLoadMetricsEmbedder(content::WebContents* web_contents);
53 ~PageLoadMetricsEmbedder() override; 53 ~PageLoadMetricsEmbedder() override;
54 54
55 // page_load_metrics::PageLoadMetricsEmbedderInterface: 55 // page_load_metrics::PageLoadMetricsEmbedderInterface:
56 bool IsNewTabPageUrl(const GURL& url) override; 56 bool IsNewTabPageUrl(const GURL& url) override;
57 void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override; 57 void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override;
58 std::unique_ptr<base::Timer> CreateTimer() override;
58 59
59 private: 60 private:
60 bool IsPrerendering() const; 61 bool IsPrerendering() const;
61 62
62 content::WebContents* const web_contents_; 63 content::WebContents* const web_contents_;
63 64
64 DISALLOW_COPY_AND_ASSIGN(PageLoadMetricsEmbedder); 65 DISALLOW_COPY_AND_ASSIGN(PageLoadMetricsEmbedder);
65 }; 66 };
66 67
67 PageLoadMetricsEmbedder::PageLoadMetricsEmbedder( 68 PageLoadMetricsEmbedder::PageLoadMetricsEmbedder(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 base::MakeUnique<OmniboxSuggestionUsedMetricsObserver>(IsPrerendering())); 136 base::MakeUnique<OmniboxSuggestionUsedMetricsObserver>(IsPrerendering()));
136 tracker->AddObserver( 137 tracker->AddObserver(
137 base::MakeUnique<DelayNavigationPageLoadMetricsObserver>()); 138 base::MakeUnique<DelayNavigationPageLoadMetricsObserver>());
138 } 139 }
139 140
140 bool PageLoadMetricsEmbedder::IsPrerendering() const { 141 bool PageLoadMetricsEmbedder::IsPrerendering() const {
141 return prerender::PrerenderContents::FromWebContents(web_contents_) != 142 return prerender::PrerenderContents::FromWebContents(web_contents_) !=
142 nullptr; 143 nullptr;
143 } 144 }
144 145
146 std::unique_ptr<base::Timer> PageLoadMetricsEmbedder::CreateTimer() {
Charlie Harrison 2017/05/30 14:49:07 #include base/timer
Bryan McQuade 2017/05/30 15:30:22 done
147 return base::MakeUnique<base::OneShotTimer>();
148 }
149
145 bool PageLoadMetricsEmbedder::IsNewTabPageUrl(const GURL& url) { 150 bool PageLoadMetricsEmbedder::IsNewTabPageUrl(const GURL& url) {
146 Profile* profile = 151 Profile* profile =
147 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); 152 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
148 if (!profile) 153 if (!profile)
149 return false; 154 return false;
150 return search::IsInstantNTPURL(url, profile); 155 return search::IsInstantNTPURL(url, profile);
151 } 156 }
152 157
153 } // namespace 158 } // namespace
154 159
155 void InitializePageLoadMetricsForWebContents( 160 void InitializePageLoadMetricsForWebContents(
156 content::WebContents* web_contents, 161 content::WebContents* web_contents,
157 const base::Optional<content::WebContents::CreateParams>& create_params) { 162 const base::Optional<content::WebContents::CreateParams>& create_params) {
158 page_load_metrics::MetricsWebContentsObserver::CreateForWebContents( 163 page_load_metrics::MetricsWebContentsObserver::CreateForWebContents(
159 web_contents, create_params, 164 web_contents, create_params,
160 base::MakeUnique<PageLoadMetricsEmbedder>(web_contents)); 165 base::MakeUnique<PageLoadMetricsEmbedder>(web_contents));
161 } 166 }
162 167
163 } // namespace chrome 168 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698