OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // An interface to platform-specific storage of IncidentReportingService prune | 5 // An interface to platform-specific storage of IncidentReportingService prune |
6 // state. | 6 // state. |
7 | 7 |
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PLATFORM_STATE_STORE_H_ | 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PLATFORM_STATE_STORE_H_ |
9 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PLATFORM_STATE_STORE_H_ | 9 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PLATFORM_STATE_STORE_H_ |
10 | 10 |
11 #include <stdint.h> | 11 #include <stdint.h> |
| 12 |
| 13 #include <memory> |
12 #include <string> | 14 #include <string> |
13 | 15 |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 | 17 |
17 // Certain platforms provide their own storage of protobuf-serialized prune | 18 // Certain platforms provide their own storage of protobuf-serialized prune |
18 // state. On platforms where it is not supported, Load() and Store() are noops. | 19 // state. On platforms where it is not supported, Load() and Store() are noops. |
19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
20 // Store the state in the registry on Windows. | 21 // Store the state in the registry on Windows. |
21 #define USE_PLATFORM_STATE_STORE | 22 #define USE_PLATFORM_STATE_STORE |
22 #endif | 23 #endif |
23 | 24 |
24 class Profile; | 25 class Profile; |
25 | 26 |
26 namespace base { | 27 namespace base { |
27 class DictionaryValue; | 28 class DictionaryValue; |
28 } | 29 } |
29 | 30 |
30 namespace safe_browsing { | 31 namespace safe_browsing { |
31 namespace platform_state_store { | 32 namespace platform_state_store { |
32 | 33 |
33 // Loads the platform-specific storage for |profile|. Returns null if there is | 34 // Loads the platform-specific storage for |profile|. Returns null if there is |
34 // no such storage for the current platform or in case of error; otherwise, a | 35 // no such storage for the current platform or in case of error; otherwise, a |
35 // (possibly empty) dictionary. | 36 // (possibly empty) dictionary. |
36 scoped_ptr<base::DictionaryValue> Load(Profile* profile); | 37 std::unique_ptr<base::DictionaryValue> Load(Profile* profile); |
37 | 38 |
38 // Stores the state for |profile| in |incidents_sent| into platform-specific | 39 // Stores the state for |profile| in |incidents_sent| into platform-specific |
39 // storage if there is such for the current platform. | 40 // storage if there is such for the current platform. |
40 void Store(Profile* profile, const base::DictionaryValue* incidents_sent); | 41 void Store(Profile* profile, const base::DictionaryValue* incidents_sent); |
41 | 42 |
42 #if defined(USE_PLATFORM_STATE_STORE) | 43 #if defined(USE_PLATFORM_STATE_STORE) |
43 | 44 |
44 // All declarations and definitions from this point forward are for use by | 45 // All declarations and definitions from this point forward are for use by |
45 // implementations in platform-specific source files, or are exposed for the | 46 // implementations in platform-specific source files, or are exposed for the |
46 // sake of testing. | 47 // sake of testing. |
(...skipping 29 matching lines...) Expand all Loading... |
76 PlatformStateStoreLoadResult DeserializeIncidentsSent( | 77 PlatformStateStoreLoadResult DeserializeIncidentsSent( |
77 const std::string& data, | 78 const std::string& data, |
78 base::DictionaryValue* value_dict); | 79 base::DictionaryValue* value_dict); |
79 | 80 |
80 #endif // USE_PLATFORM_STATE_STORE | 81 #endif // USE_PLATFORM_STATE_STORE |
81 | 82 |
82 } // namespace platform_state_store | 83 } // namespace platform_state_store |
83 } // namespace safe_browsing | 84 } // namespace safe_browsing |
84 | 85 |
85 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PLATFORM_STATE_STORE_
H_ | 86 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PLATFORM_STATE_STORE_
H_ |
OLD | NEW |