OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_APP_APPLICATION_DELEGATE_METRICS_MEDIATOR_H_ |
| 6 #define IOS_CHROME_APP_APPLICATION_DELEGATE_METRICS_MEDIATOR_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 @protocol StartupInformation; |
| 11 |
| 12 @protocol BrowserViewInformation; |
| 13 @protocol StartupInformation; |
| 14 |
| 15 namespace metrics_mediator { |
| 16 // Key in the UserDefaults to store the date/time that the background fetch |
| 17 // handler was called. |
| 18 extern NSString* const kAppEnteredBackgroundDateKey; |
| 19 } // namespace metrics_mediator |
| 20 |
| 21 // Deals with metrics, checking and updating them accordingly to to the user |
| 22 // preferences. |
| 23 @interface MetricsMediator : NSObject |
| 24 // Returns YES if the metrics pref is enabled. Does not take into account the |
| 25 // wifi-only option or wwan state. |
| 26 - (BOOL)areMetricsEnabled; |
| 27 // Return YES if uploading is allowed, based on user preferences. |
| 28 - (BOOL)isUploadingEnabled; |
| 29 // Starts or stops the metrics service and crash report recording and/or |
| 30 // uploading, based on the current user preferences. Makes sure helper |
| 31 // mechanisms and the wwan state observer are set up if necessary. Called both |
| 32 // on initialization and after user triggered preference change. |
| 33 // |isUserTriggered| is used to distinguish between those cases. |
| 34 - (void)updateMetricsStateBasedOnPrefsUserTriggered:(BOOL)isUserTriggered; |
| 35 // Logs the duration of the cold start startup. Does nothing if there isn't a |
| 36 // cold start. |
| 37 + (void)logStartupDuration:(id<StartupInformation>)startupInformation; |
| 38 // Logs the number of tabs open and the start type. |
| 39 + (void)logLaunchMetricsWithStartupInformation: |
| 40 (id<StartupInformation>)startupInformation |
| 41 browserViewInformation: |
| 42 (id<BrowserViewInformation>)browserViewInformation; |
| 43 // Logs in UserDefaults the current date with kAppEnteredBackgroundDateKey as |
| 44 // key. |
| 45 + (void)logDateInUserDefaults; |
| 46 // Disables reporting in breakpad and metrics service. |
| 47 + (void)disableReporting; |
| 48 // Logs that the application is in background and the number of memory warnings |
| 49 // for this session. |
| 50 + (void)applicationDidEnterBackground:(NSInteger)memoryWarningCount; |
| 51 |
| 52 @end |
| 53 |
| 54 #endif // IOS_CHROME_APP_APPLICATION_DELEGATE_METRICS_MEDIATOR_H_ |
OLD | NEW |