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

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

Issue 2952343004: Adding previews information to PLM UKM (Closed)
Patch Set: stop observing on background 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/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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 if (observer_) { 677 if (observer_) {
678 observer_->RemoveTestingObserver(this); 678 observer_->RemoveTestingObserver(this);
679 observer_ = nullptr; 679 observer_ = nullptr;
680 } 680 }
681 } 681 }
682 682
683 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() { 683 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() {
684 observer_ = nullptr; 684 observer_ = nullptr;
685 } 685 }
686 686
687 base::Optional<ukm::SourceId>
688 MetricsWebContentsObserver::GetUKMSourceIdForNavigationHandle(
689 content::NavigationHandle* navigation_handle) {
690 base::Optional<ukm::SourceId> source_id;
691 auto it = provisional_loads_.find(navigation_handle);
692 if (it != provisional_loads_.end())
693 source_id = it->second->source_id();
694 return source_id;
695 }
696
697 base::Optional<ukm::SourceId>
698 MetricsWebContentsObserver::GetUKMSourceForCommittedLoad() {
699 base::Optional<ukm::SourceId> source_id;
700 if (committed_load_)
701 source_id = committed_load_->source_id();
702 return source_id;
703 }
704
687 } // namespace page_load_metrics 705 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698