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

Unified Diff: ios/chrome/browser/metrics/tab_usage_recorder.mm

Issue 2820763002: Remove usage of Tab's |url| property from TabUsageRecorder. (Closed)
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/metrics/BUILD.gn ('k') | ios/chrome/browser/metrics/tab_usage_recorder_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/metrics/tab_usage_recorder.mm
diff --git a/ios/chrome/browser/metrics/tab_usage_recorder.mm b/ios/chrome/browser/metrics/tab_usage_recorder.mm
index b8cd3ba755c83c10c1579699f08b611a79172efe..f4d1b87b78d0bbb2c0a24b610b608d1203b5c8f3 100644
--- a/ios/chrome/browser/metrics/tab_usage_recorder.mm
+++ b/ios/chrome/browser/metrics/tab_usage_recorder.mm
@@ -8,6 +8,9 @@
#include "ios/chrome/browser/chrome_url_constants.h"
#import "ios/chrome/browser/metrics/previous_session_info.h"
#import "ios/chrome/browser/tabs/tab.h"
+#import "ios/web/public/navigation_item.h"
+#import "ios/web/public/navigation_manager.h"
+#import "ios/web/public/web_state/web_state.h"
#import "ios/web/web_state/ui/crw_web_controller.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
@@ -298,7 +301,11 @@
bool TabUsageRecorder::ShouldIgnoreTab(Tab* tab) {
// Do not count chrome:// urls to avoid data noise. For example, if they were
// counted, every new tab created would add noise to the page load count.
- return [tab url].SchemeIs(kChromeUIScheme);
+ web::NavigationItem* pending_item =
+ tab.webState->GetNavigationManager()->GetPendingItem();
+ if (pending_item)
+ return pending_item->GetURL().SchemeIs(kChromeUIScheme);
+ return tab.lastCommittedURL.SchemeIs(kChromeUIScheme);
}
bool TabUsageRecorder::TabAlreadyEvicted(Tab* tab) {
« no previous file with comments | « ios/chrome/browser/metrics/BUILD.gn ('k') | ios/chrome/browser/metrics/tab_usage_recorder_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698