| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 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 | 
|  | 3 // found in the LICENSE file. | 
|  | 4 | 
|  | 5 #ifndef IOS_CHROME_BROWSER_METRICS_IOS_STABILITY_METRICS_PROVIDER_H_ | 
|  | 6 #define IOS_CHROME_BROWSER_METRICS_IOS_STABILITY_METRICS_PROVIDER_H_ | 
|  | 7 | 
|  | 8 #include "base/macros.h" | 
|  | 9 #include "base/memory/scoped_ptr.h" | 
|  | 10 #include "components/metrics/metrics_provider.h" | 
|  | 11 | 
|  | 12 namespace metrics { | 
|  | 13 class MetricsService; | 
|  | 14 } | 
|  | 15 | 
|  | 16 // Exposed for testing purposes only. | 
|  | 17 // Values of the UMA Stability.MobileSessionShutdownType histogram. | 
|  | 18 enum MobileSessionShutdownType { | 
|  | 19   SHUTDOWN_IN_BACKGROUND = 0, | 
|  | 20   SHUTDOWN_IN_FOREGROUND_NO_CRASH_LOG_NO_MEMORY_WARNING, | 
|  | 21   SHUTDOWN_IN_FOREGROUND_WITH_CRASH_LOG_NO_MEMORY_WARNING, | 
|  | 22   SHUTDOWN_IN_FOREGROUND_NO_CRASH_LOG_WITH_MEMORY_WARNING, | 
|  | 23   SHUTDOWN_IN_FOREGROUND_WITH_CRASH_LOG_WITH_MEMORY_WARNING, | 
|  | 24   FIRST_LAUNCH_AFTER_UPGRADE, | 
|  | 25   MOBILE_SESSION_SHUTDOWN_TYPE_COUNT, | 
|  | 26 }; | 
|  | 27 | 
|  | 28 class IOSStabilityMetricsProvider : public metrics::MetricsProvider { | 
|  | 29  public: | 
|  | 30   explicit IOSStabilityMetricsProvider( | 
|  | 31       metrics::MetricsService* metrics_service); | 
|  | 32   ~IOSStabilityMetricsProvider() override; | 
|  | 33 | 
|  | 34   // metrics::MetricsProvider | 
|  | 35   bool HasInitialStabilityMetrics() override; | 
|  | 36   void ProvideInitialStabilityMetrics( | 
|  | 37       metrics::SystemProfileProto* system_profile_proto) override; | 
|  | 38 | 
|  | 39  protected: | 
|  | 40   // Provides information on the last session environment, used to decide what | 
|  | 41   // stability metrics to provide in ProvideInitialStabilityMetrics. | 
|  | 42   // These methods are virtual to be overridden in the tests. | 
|  | 43   // The default implementations return the real values. | 
|  | 44 | 
|  | 45   // Whether this is the first time the app is launched after an upgrade. | 
|  | 46   virtual bool IsFirstLaunchAfterUpgrade(); | 
|  | 47 | 
|  | 48   // Whether there are crash reports to upload. | 
|  | 49   virtual bool HasCrashLogs(); | 
|  | 50 | 
|  | 51   // Whether there were crash reports that have been uploaded in background | 
|  | 52   // since the last full start. | 
|  | 53   virtual bool HasUploadedCrashReportsInBackground(); | 
|  | 54 | 
|  | 55   // Whether there was a memory warning shortly before last shutdown. | 
|  | 56   virtual bool ReceivedMemoryWarningBeforeLastShutdown(); | 
|  | 57 | 
|  | 58  private: | 
|  | 59   metrics::MetricsService* metrics_service_; | 
|  | 60   DISALLOW_COPY_AND_ASSIGN(IOSStabilityMetricsProvider); | 
|  | 61 }; | 
|  | 62 | 
|  | 63 #endif  // IOS_CHROME_BROWSER_METRICS_IOS_STABILITY_METRICS_PROVIDER_H_ | 
| OLD | NEW | 
|---|