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

Side by Side Diff: chrome/browser/profile_resetter/triggered_profile_resetter.h

Issue 1294923003: Add a triggered profile reset mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle background case by clearing flag in startup browser creator. Created 5 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/profile_resetter/triggered_profile_resetter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 CHROME_BROWSER_PROFILE_RESETTER_TRIGGERED_PROFILE_RESETTER_H_
6 #define CHROME_BROWSER_PROFILE_RESETTER_TRIGGERED_PROFILE_RESETTER_H_
7
8 #include "base/macros.h"
9 #include "base/strings/string16.h"
10 #include "components/keyed_service/core/keyed_service.h"
11
12 class Profile;
13
14 // This service is responsible for evaluating whether a profile reset trigger
15 // has been set and not yet consumed by |profile_|. If it has, the profile is
16 // eligible for reset and a profile reset UI will be shown to the user. The
17 // intended use case for this is to provide a sanctioned profile reset API for
18 // third party tools (anti-virus or cleaner tools) that wish to reset users'
19 // profiles as part of their cleanup flow.
20 //
21 // To use this mechanism from a third party tool, perform the following steps:
22 // 1) Create (or open) the registry key
23 // HKCU\Software\$PRODUCT_STRING_PATH\TriggeredReset where
24 // $PRODUCT_STRING_PATH is one of the values in
25 // chrome\common\chrome_constants.h, currently either "Google\\Chrome" or
26 // "Chromium".
27 // 2) Set a REG_SZ value called "ToolName" to the localized name of the tool.
28 // This string (truncated to kMaxToolNameLength) will be displayed in a
29 // notification UI. The "ToolName" should be just the name of the tool,
30 // e.g. "AwesomeAV".
31 // 3) Set a REG_QWORD value called "Timestamp" with a timestamp for the reset
32 // event. This value should be obtained from a call to
33 // ::GetSystemTimeAsFileTime() at the time the reset is requested. This
34 // value will be persisted in the profile when it is reset and will be used
35 // to avoid multiple resets.
36 //
37 // Some considerations:
38 //
39 // * Chrome supports multiple profiles. When the above steps are followed,
40 // each profile will enter the reset flow as it is opened.
41 // * New profiles created while any timestamp is present will not get the reset
42 // flow.
43 class TriggeredProfileResetter : public KeyedService {
44 public:
45 enum : size_t { kMaxToolNameLength = 100 };
46
47 explicit TriggeredProfileResetter(Profile* profile);
48 ~TriggeredProfileResetter() override;
49
50 // Causes the TriggeredProfileResetter to look for the presence of a trigger.
51 // If a trigger is found, it is disarmed so that future instances of the
52 // service will no longer trigger a reset. Subsequent calls to HasResetTrigger
53 // will return whether |profile_| is subject to a reset.
54 virtual void Activate();
55
56 // Returns true iff the given profile has a trigger set for a reset UI flow
57 // according to the description in the class comment. Must call Activate()
58 // first.
59 virtual bool HasResetTrigger();
60
61 // Clears the reset trigger such that subsequent calls to |HasResetTrigger|
62 // will return false. Used since
robertshield 2015/09/21 04:17:30 Note to self: stray typing here. Fix when VPN work
63 virtual void ClearResetTrigger();
64
65 // Returns the name of the tool that performed the reset. This string will be
66 // truncated to a length of |kMaxToolNameLength|.
67 virtual base::string16 GetResetToolName();
68
69 private:
70 Profile* profile_;
71
72 bool has_reset_trigger_ = false;
73 bool activate_called_ = false;
74
75 base::string16 tool_name_;
76
77 DISALLOW_COPY_AND_ASSIGN(TriggeredProfileResetter);
78 };
79
80 // Exposed for testing.
81 extern const wchar_t kTriggeredResetRegistryPath[];
82 extern const wchar_t kTriggeredResetToolName[];
83 extern const wchar_t kTriggeredResetTimestamp[];
84
85 #endif // CHROME_BROWSER_PROFILE_RESETTER_TRIGGERED_PROFILE_RESETTER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profile_resetter/triggered_profile_resetter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698