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

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

Issue 2857963002: Revert "[PageLoadMetrics] Keep track of Ad Sizes on Pages" (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « chrome/browser/page_load_metrics/page_load_tracker.h ('k') | chrome/test/BUILD.gn » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_tracker.h" 5 #include "chrome/browser/page_load_metrics/page_load_tracker.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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } 474 }
475 475
476 INVOKE_AND_PRUNE_OBSERVERS(observers_, OnShown); 476 INVOKE_AND_PRUNE_OBSERVERS(observers_, OnShown);
477 } 477 }
478 478
479 void PageLoadTracker::WillProcessNavigationResponse( 479 void PageLoadTracker::WillProcessNavigationResponse(
480 content::NavigationHandle* navigation_handle) { 480 content::NavigationHandle* navigation_handle) {
481 // PlzNavigate: NavigationHandle::GetGlobalRequestID() sometimes returns an 481 // PlzNavigate: NavigationHandle::GetGlobalRequestID() sometimes returns an
482 // uninitialized GlobalRequestID. Bail early in this case. See 482 // uninitialized GlobalRequestID. Bail early in this case. See
483 // crbug.com/680841 for details. 483 // crbug.com/680841 for details.
484 // TODO(jkarlin): NavigationSimulator is the first unittest framework to hit 484 if (content::IsBrowserSideNavigationEnabled() &&
485 // this function, and it doesn't provide a GlobalRequestID. Add an ID. See 485 navigation_handle->GetGlobalRequestID() == content::GlobalRequestID())
486 // crbug.com/711352 for details.
487 if (navigation_handle->GetGlobalRequestID() == content::GlobalRequestID())
488 return; 486 return;
489 487
490 DCHECK(!navigation_request_id_.has_value()); 488 DCHECK(!navigation_request_id_.has_value());
491 navigation_request_id_ = navigation_handle->GetGlobalRequestID(); 489 navigation_request_id_ = navigation_handle->GetGlobalRequestID();
492 DCHECK(navigation_request_id_.value() != content::GlobalRequestID()); 490 DCHECK(navigation_request_id_.value() != content::GlobalRequestID());
493 } 491 }
494 492
495 void PageLoadTracker::Commit(content::NavigationHandle* navigation_handle) { 493 void PageLoadTracker::Commit(content::NavigationHandle* navigation_handle) {
496 did_commit_ = true; 494 did_commit_ = true;
497 url_ = navigation_handle->GetURL(); 495 url_ = navigation_handle->GetURL();
498 // Some transitions (like CLIENT_REDIRECT) are only known at commit time. 496 // Some transitions (like CLIENT_REDIRECT) are only known at commit time.
499 page_transition_ = navigation_handle->GetPageTransition(); 497 page_transition_ = navigation_handle->GetPageTransition();
500 user_initiated_info_.user_gesture = navigation_handle->HasUserGesture(); 498 user_initiated_info_.user_gesture = navigation_handle->HasUserGesture();
501 499
502 INVOKE_AND_PRUNE_OBSERVERS( 500 INVOKE_AND_PRUNE_OBSERVERS(
503 observers_, ShouldObserveMimeType, 501 observers_, ShouldObserveMimeType,
504 navigation_handle->GetWebContents()->GetContentsMimeType()); 502 navigation_handle->GetWebContents()->GetContentsMimeType());
505 503
506 INVOKE_AND_PRUNE_OBSERVERS(observers_, OnCommit, navigation_handle); 504 INVOKE_AND_PRUNE_OBSERVERS(observers_, OnCommit, navigation_handle);
507 LogAbortChainHistograms(navigation_handle); 505 LogAbortChainHistograms(navigation_handle);
508 } 506 }
509 507
510 void PageLoadTracker::DidFinishSubFrameNavigation(
511 content::NavigationHandle* navigation_handle) {
512 INVOKE_AND_PRUNE_OBSERVERS(observers_, OnDidFinishSubFrameNavigation,
513 navigation_handle);
514 }
515
516 void PageLoadTracker::FailedProvisionalLoad( 508 void PageLoadTracker::FailedProvisionalLoad(
517 content::NavigationHandle* navigation_handle, 509 content::NavigationHandle* navigation_handle,
518 base::TimeTicks failed_load_time) { 510 base::TimeTicks failed_load_time) {
519 DCHECK(!failed_provisional_load_info_); 511 DCHECK(!failed_provisional_load_info_);
520 failed_provisional_load_info_.reset(new FailedProvisionalLoadInfo( 512 failed_provisional_load_info_.reset(new FailedProvisionalLoadInfo(
521 failed_load_time - navigation_handle->NavigationStart(), 513 failed_load_time - navigation_handle->NavigationStart(),
522 navigation_handle->GetNetErrorCode())); 514 navigation_handle->GetNetErrorCode()));
523 } 515 }
524 516
525 void PageLoadTracker::Redirect(content::NavigationHandle* navigation_handle) { 517 void PageLoadTracker::Redirect(content::NavigationHandle* navigation_handle) {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 observer->MediaStartedPlaying(video_type, is_in_main_frame); 804 observer->MediaStartedPlaying(video_type, is_in_main_frame);
813 } 805 }
814 806
815 void PageLoadTracker::OnNavigationDelayComplete(base::TimeDelta scheduled_delay, 807 void PageLoadTracker::OnNavigationDelayComplete(base::TimeDelta scheduled_delay,
816 base::TimeDelta actual_delay) { 808 base::TimeDelta actual_delay) {
817 for (const auto& observer : observers_) 809 for (const auto& observer : observers_)
818 observer->OnNavigationDelayComplete(scheduled_delay, actual_delay); 810 observer->OnNavigationDelayComplete(scheduled_delay, actual_delay);
819 } 811 }
820 812
821 } // namespace page_load_metrics 813 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « chrome/browser/page_load_metrics/page_load_tracker.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698