Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 COMPONENTS_METRICS_CLEAN_EXIT_BEACON_H_ | |
| 6 #define COMPONENTS_METRICS_CLEAN_EXIT_BEACON_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 | |
| 10 #if defined(OS_WIN) | |
|
Alexei Svitkine (slow)
2014/09/11 15:23:28
Nit: Remove ifdef. You don't have it in metrics_se
erikwright (departed)
2014/09/11 19:00:29
Done.
| |
| 11 #include "base/strings/string16.h" | |
| 12 #endif | |
| 13 | |
| 14 class PrefService; | |
| 15 class PrefRegistrySimple; | |
| 16 | |
| 17 // Reads and updates a beacon used to detect whether the previous browser | |
| 18 // process exited cleanly. | |
| 19 class CleanExitBeacon { | |
| 20 public: | |
| 21 // Instantiates a CleanExitBeacon whose value is stored in |local_state|. | |
| 22 // |local_state| must be fully initialized. | |
| 23 // A PrefRegistrySimple corresponding to |local_state| must have previously | |
| 24 // been passed to RegisterPrefs. | |
| 25 // On Windows, |backup_registry_key| is used to store a backup of the beacon. | |
| 26 CleanExitBeacon( | |
| 27 #if defined(OS_WIN) | |
| 28 const base::string16& backup_registry_key, | |
| 29 #endif | |
| 30 PrefService* local_state); | |
| 31 | |
| 32 ~CleanExitBeacon(); | |
| 33 | |
| 34 // Registers preferences used by this class in |registry|. | |
| 35 static void RegisterPrefs(PrefRegistrySimple* registry); | |
| 36 | |
| 37 // Returns the original value of the beacon. | |
| 38 bool exited_cleanly() { return initial_value_; } | |
|
Alexei Svitkine (slow)
2014/09/11 15:23:28
Nit: const
erikwright (departed)
2014/09/11 19:00:29
Done.
| |
| 39 | |
| 40 // Writes the provided beacon value. | |
| 41 void WriteBeaconValue(bool exited_cleanly); | |
| 42 | |
| 43 private: | |
| 44 PrefService* const local_state_; | |
| 45 const bool initial_value_; | |
| 46 #if defined(OS_WIN) | |
| 47 const base::string16 backup_registry_key_; | |
| 48 #endif | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(CleanExitBeacon); | |
| 51 }; | |
| 52 | |
| 53 #endif // COMPONENTS_METRICS_CLEAN_EXIT_BEACON_H_ | |
| OLD | NEW |