Clean up extension confirmation prompts and make them consistent between Views and...
[chromium-blink-merge.git] / components / metrics / clean_exit_beacon.h
blob6b896fa17845a39afb490c123bf7b2cb0f4c2c0d
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.
5 #ifndef COMPONENTS_METRICS_CLEAN_EXIT_BEACON_H_
6 #define COMPONENTS_METRICS_CLEAN_EXIT_BEACON_H_
8 #include "base/macros.h"
9 #include "base/strings/string16.h"
11 class PrefService;
13 namespace metrics {
15 // Reads and updates a beacon used to detect whether the previous browser
16 // process exited cleanly.
17 class CleanExitBeacon {
18 public:
19 // Instantiates a CleanExitBeacon whose value is stored in |local_state|.
20 // |local_state| must be fully initialized.
21 // On Windows, |backup_registry_key| is used to store a backup of the beacon.
22 // It is ignored on other platforms.
23 CleanExitBeacon(
24 const base::string16& backup_registry_key,
25 PrefService* local_state);
27 ~CleanExitBeacon();
29 // Returns the original value of the beacon.
30 bool exited_cleanly() const { return initial_value_; }
32 // Writes the provided beacon value.
33 void WriteBeaconValue(bool exited_cleanly);
35 private:
36 PrefService* const local_state_;
37 const bool initial_value_;
38 const base::string16 backup_registry_key_;
40 DISALLOW_COPY_AND_ASSIGN(CleanExitBeacon);
43 } // namespace metrics
45 #endif // COMPONENTS_METRICS_CLEAN_EXIT_BEACON_H_