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

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

Issue 2481013007: Improve tracking of user initiated page loads. (Closed)
Patch Set: address comments Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/metrics_web_contents_observer.h" 5 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // net::ERR_ABORTED. 243 // net::ERR_ABORTED.
244 if ((error == net::OK) || (error == net::ERR_ABORTED)) { 244 if ((error == net::OK) || (error == net::ERR_ABORTED)) {
245 tracker->NotifyAbort(ABORT_OTHER, false, base::TimeTicks::Now(), true); 245 tracker->NotifyAbort(ABORT_OTHER, false, base::TimeTicks::Now(), true);
246 aborted_provisional_loads_.push_back(std::move(tracker)); 246 aborted_provisional_loads_.push_back(std::move(tracker));
247 } 247 }
248 } 248 }
249 249
250 void MetricsWebContentsObserver::HandleCommittedNavigationForTrackedLoad( 250 void MetricsWebContentsObserver::HandleCommittedNavigationForTrackedLoad(
251 content::NavigationHandle* navigation_handle, 251 content::NavigationHandle* navigation_handle,
252 std::unique_ptr<PageLoadTracker> tracker) { 252 std::unique_ptr<PageLoadTracker> tracker) {
253 if (!navigation_handle->HasUserGesture() && 253 if (!IsNavigationUserInitiated(navigation_handle) &&
254 (navigation_handle->GetPageTransition() & 254 (navigation_handle->GetPageTransition() &
255 ui::PAGE_TRANSITION_CLIENT_REDIRECT) != 0 && 255 ui::PAGE_TRANSITION_CLIENT_REDIRECT) != 0 &&
256 committed_load_) 256 committed_load_)
257 committed_load_->NotifyClientRedirectTo(*tracker); 257 committed_load_->NotifyClientRedirectTo(*tracker);
258 258
259 committed_load_ = std::move(tracker); 259 committed_load_ = std::move(tracker);
260 committed_load_->Commit(navigation_handle); 260 committed_load_->Commit(navigation_handle);
261 } 261 }
262 262
263 void MetricsWebContentsObserver::NavigationStopped() { 263 void MetricsWebContentsObserver::NavigationStopped() {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 content::NavigationHandle* navigation_handle) const { 439 content::NavigationHandle* navigation_handle) const {
440 DCHECK(navigation_handle->IsInMainFrame()); 440 DCHECK(navigation_handle->IsInMainFrame());
441 DCHECK(!navigation_handle->HasCommitted() || 441 DCHECK(!navigation_handle->HasCommitted() ||
442 !navigation_handle->IsSamePage()); 442 !navigation_handle->IsSamePage());
443 443
444 return BrowserPageTrackDecider(embedder_interface_.get(), web_contents(), 444 return BrowserPageTrackDecider(embedder_interface_.get(), web_contents(),
445 navigation_handle).ShouldTrack(); 445 navigation_handle).ShouldTrack();
446 } 446 }
447 447
448 } // namespace page_load_metrics 448 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698