Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(942)

Side by Side Diff: client/settings.h

Issue 988063003: Define the Settings interface for a CrashReportDatabase and provide a Mac implementation. (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #ifndef CRASHPAD_CLIENT_SETTINGS_H_
16 #define CRASHPAD_CLIENT_SETTINGS_H_
17
18 #include <time.h>
19
20 #include <string>
21
22 #include "base/basictypes.h"
23
24 namespace crashpad {
25
26 //! \brief An interface for accessing and modifying the settings of a
27 //! CrashReportDatabase.
28 //!
29 //! This class cannot be instantiated directly, but rather an instance of it
30 //! should be retrieved via CrashReportDatabase::GetSettings().
31 class Settings {
32 public:
33 //! \brief Retrieves the immutable identifier for this client, which is used
34 //! to locate all crash reports from a specific Crashpad database.
35 //!
36 //! This is automatically initialized when the database is created.
37 //!
38 //! \param[out] client_id The unique client identifier.
39 //!
40 //! \return On success, returns `true`, otherwise returns `false` with an
41 //! error logged.
42 virtual bool GetClientID(std::string* client_id) = 0;
43
44 //! \brief Retrieves the user’s preference for submitting crash reports to a
45 //! collection server.
46 //!
47 //! The default value is `false`.
48 //!
49 //! \param[out] enabled Whether crash reports should be uploaded.
50 //!
51 //! \return On success, returns `true`, otherwise returns `false` with an
52 //! error logged.
53 virtual bool GetUploadsEnabled(bool* enabled) = 0;
54
55 //! \brief Sets the user’s preference for submitting crash reports to a
56 //! collection server.
57 //!
58 //! \param[in] enabled Whether crash reports should be uploaded.
59 //!
60 //! \return On success, returns `true`, otherwise returns `false` with an
61 //! error logged.
62 virtual bool SetUploadsEnabled(bool enabled) = 0;
63
64 //! \brief Retrieves the last time at which a report was attempted to be
65 //! uploaded.
66 //!
67 //! The default value is `0` if it has never been set before.
68 //!
69 //! \param[out] time The last time at which a report was uploaded.
70 //!
71 //! \return On success, returns `true`, otherwise returns `false` with an
72 //! error logged.
73 virtual bool GetLastUploadAttemptTime(time_t* time) = 0;
74
75 //! \brief Sets the last time at which a report was attempted to be uploaded.
76 //!
77 //! This is only meant to be used internally by the CrashReportDatabase.
78 //!
79 //! \param[in] time The last time at which a report was uploaded.
80 //!
81 //! \return On success, returns `true`, otherwise returns `false` with an
82 //! error logged.
83 virtual bool SetLastUploadAttemptTime(time_t time) = 0;
84
85 protected:
86 Settings() {}
87 virtual ~Settings() {}
88
89 private:
90 DISALLOW_COPY_AND_ASSIGN(Settings);
91 };
92
93 } // namespace crashpad
94
95 #endif // CRASHPAD_CLIENT_SETTINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698