Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "ios/chrome/browser/tabs/tab_model_metrics_observer.h" | |
|
marq (ping after 24h)
2017/02/13 17:06:54
Can you put this in ios/shared/, since it's free o
sdefresne
2017/02/14 17:19:38
Should I rename it WebStateListMetricsObserver the
| |
| 6 | |
| 7 #include "base/metrics/user_metrics.h" | |
| 8 #include "base/metrics/user_metrics_action.h" | |
| 9 | |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 11 #error "This file requires ARC support." | |
| 12 #endif | |
| 13 | |
| 14 @implementation TabModelMetricsObserver | |
| 15 | |
| 16 #pragma mark WebStateListObserver | |
| 17 | |
| 18 - (void)webStateList:(WebStateList*)webStateList | |
| 19 webStateInserted:(web::WebState*)webState | |
| 20 atIndex:(NSUInteger)index { | |
| 21 base::RecordAction(base::UserMetricsAction("MobileNewTabOpened")); | |
| 22 } | |
| 23 | |
| 24 - (void)webStateList:(WebStateList*)webStateList | |
| 25 webStateReplaced:(web::WebState*)oldWebState | |
| 26 byWebState:(web::WebState*)newWebState | |
| 27 atIndex:(NSUInteger)index { | |
| 28 // Record a tab clobber, since swapping tabs bypasses the Tab code that would | |
| 29 // normally log clobbers. | |
| 30 base::RecordAction(base::UserMetricsAction("MobileTabClobbered")); | |
| 31 } | |
| 32 | |
| 33 - (void)webStateList:(WebStateList*)webStateList | |
| 34 webStateRemoved:(web::WebState*)webState | |
| 35 atIndex:(NSUInteger)index { | |
| 36 base::RecordAction(base::UserMetricsAction("MobileTabClosed")); | |
| 37 } | |
| 38 | |
| 39 @end | |
| OLD | NEW |