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

Unified Diff: ios/shared/chrome/browser/tabs/web_state_list_metrics_observer.mm

Issue 2687303003: Convert some of TabModel logic to WebStateListObservers. (Closed)
Patch Set: Rebase. Created 3 years, 10 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/shared/chrome/browser/tabs/web_state_list_metrics_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/shared/chrome/browser/tabs/web_state_list_metrics_observer.mm
diff --git a/ios/shared/chrome/browser/tabs/web_state_list_metrics_observer.mm b/ios/shared/chrome/browser/tabs/web_state_list_metrics_observer.mm
new file mode 100644
index 0000000000000000000000000000000000000000..fd223b4394c0f3641be6cb9ee6b341b055eefa92
--- /dev/null
+++ b/ios/shared/chrome/browser/tabs/web_state_list_metrics_observer.mm
@@ -0,0 +1,45 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/shared/chrome/browser/tabs/web_state_list_metrics_observer.h"
+
+#include "base/metrics/user_metrics.h"
+#include "base/metrics/user_metrics_action.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+WebStateListMetricsObserver::WebStateListMetricsObserver() = default;
+
+WebStateListMetricsObserver::~WebStateListMetricsObserver() = default;
+
+void WebStateListMetricsObserver::WebStateInsertedAt(
+ WebStateList* web_state_list,
+ web::WebState* web_state,
+ int index) {
+ base::RecordAction(base::UserMetricsAction("MobileNewTabOpened"));
+}
+
+void WebStateListMetricsObserver::WebStateMoved(WebStateList* web_state_list,
+ web::WebState* web_state,
+ int from_index,
+ int to_index) {}
+
+void WebStateListMetricsObserver::WebStateReplacedAt(
+ WebStateList* web_state_list,
+ web::WebState* old_web_state,
+ web::WebState* new_web_state,
+ int index) {
+ // Record a tab clobber, since swapping tabs bypasses the Tab code that would
+ // normally log clobbers.
+ base::RecordAction(base::UserMetricsAction("MobileTabClobbered"));
+}
+
+void WebStateListMetricsObserver::WebStateDetachedAt(
+ WebStateList* web_state_list,
+ web::WebState* web_state,
+ int index) {
+ base::RecordAction(base::UserMetricsAction("MobileTabClosed"));
+}
« no previous file with comments | « ios/shared/chrome/browser/tabs/web_state_list_metrics_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698