Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 <string> | |
|
grt (UTC plus 2)
2015/09/14 14:35:34
unused
robertshield
2015/09/21 04:16:22
Done.
| |
| 9 | |
| 10 #include "base/basictypes.h" | |
|
grt (UTC plus 2)
2015/09/14 14:35:34
use macros.h instead of this for DISALLOW_COPY_AND
robertshield
2015/09/21 04:16:22
Done.
| |
| 11 #include "base/logging.h" | |
| 12 #include "base/memory/ref_counted.h" | |
|
grt (UTC plus 2)
2015/09/14 14:35:34
unused
robertshield
2015/09/21 04:16:22
Done.
| |
| 13 #include "base/memory/weak_ptr.h" | |
|
grt (UTC plus 2)
2015/09/14 14:35:34
unused
robertshield
2015/09/21 04:16:22
Done.
| |
| 14 #include "base/strings/string16.h" | |
| 15 #include "components/keyed_service/core/keyed_service.h" | |
| 16 | |
| 17 class Profile; | |
| 18 | |
| 19 // This service is responsible for evaluating whether a profile reset trigger | |
| 20 // has been set and not yet consumed by |profile_|. If it has, the profile is | |
| 21 // eligible for reset and a profile reset UI will be show to the user. The | |
|
engedy
2015/09/14 23:28:55
nit: shown
robertshield
2015/09/21 04:16:22
Done.
| |
| 22 // intended use case for this is to provide a sanctioned profile reset API for | |
| 23 // third party tools (AVs or cleaner tools) that wish to reset users' profiles | |
|
engedy
2015/09/14 16:08:29
nit: s/AVs/anti-virus/, if I understand correctly.
robertshield
2015/09/21 04:16:22
Done.
| |
| 24 // as part of their cleanup flow. | |
| 25 // | |
| 26 // To use this mechanism from a third party tool, perform the following steps: | |
| 27 // 1) Create (or open) the registry key | |
| 28 // HCKU\Software\$PRODUCT_STRING_PATH\TriggeredReset where | |
|
engedy
2015/09/14 16:08:29
nit: HKCU.
robertshield
2015/09/21 04:16:22
Done.
| |
| 29 // $PRODUCT_NAME is one of the values in chrome\common\chrome_constants.h, | |
|
engedy
2015/09/14 16:08:28
I think this should be $PRODUCT_STRING_PATH.
robertshield
2015/09/21 04:16:22
Done.
| |
| 30 // currently either "Google\\Chrome" or "Chromium" | |
|
engedy
2015/09/14 23:28:55
super nit: Period at the end.
robertshield
2015/09/21 04:16:22
Done.
| |
| 31 // 2) Set a REG_SZ value called "ToolName" to the localized name of the tool. | |
| 32 // This string (truncated to kMaxToolNameLength) will be displayed in a | |
| 33 // notification UI. | |
| 34 // 3) Set a REG_QWORD value with the timestamp of the reset. This value should | |
|
engedy
2015/09/14 16:08:29
nit: Clarify what the "timestamp of the reset" mea
robertshield
2015/09/21 04:16:22
Yes, added clarifying text.
| |
| 35 // be obtained from a call to ::GetSystemTimeAsFileTime(). This value | |
| 36 // will be persisted in a reset profile and will be used to avoid | |
|
engedy
2015/09/14 16:08:29
nit: in the profile when it is reset
robertshield
2015/09/21 04:16:22
Done.
| |
| 37 // multiple resets. | |
| 38 // | |
| 39 // Some considerations: | |
| 40 // | |
| 41 // * Chrome supports multiple profiles. When the above steps are followed, | |
| 42 // each profile will enter the reset flow as it is opened. | |
| 43 // * New profiles created while a timestamp is present will not get the reset | |
|
engedy
2015/09/14 16:08:29
nit: While any timestamp is present, or after the
robertshield
2015/09/21 04:16:22
Any (updated wording).
| |
| 44 // flow. | |
| 45 class TriggeredProfileResetter : public KeyedService { | |
| 46 public: | |
| 47 enum : int { kMaxToolNameLength = 100 }; | |
|
engedy
2015/09/14 23:28:56
nit: Is there a particular reason to use the enum
grt (UTC plus 2)
2015/09/15 14:13:51
I suggested this since storage isn't needed, and t
engedy
2015/09/15 14:48:43
Thanks for pointing me to this discussion! Is ther
robertshield
2015/09/21 04:16:22
Done.
robertshield
2015/09/21 04:16:22
Acknowledged.
robertshield
2015/09/21 04:16:22
I was told in a review comment further up that the
| |
| 48 | |
| 49 explicit TriggeredProfileResetter(Profile* profile); | |
| 50 ~TriggeredProfileResetter() override; | |
| 51 | |
| 52 // Causes the TriggeredProfileResetter to look for the presence of a trigger | |
| 53 // and perform a reset, subsequent calls to HasResetTrigger will return | |
|
engedy
2015/09/14 23:28:55
Phrasing nit: s/and perform a reset, s/. If a trig
robertshield
2015/09/21 04:16:22
Done.
| |
| 54 // whether |profile_| is subject to a reset. | |
| 55 virtual void Activate(); | |
| 56 | |
| 57 // Returns true iff the given profile should have a reset reset according to | |
|
engedy
2015/09/14 23:28:55
nit: -reset
robertshield
2015/09/21 04:16:22
Done, also rephrased a bit.
| |
| 58 // the description in the class comment. Must call Activate() first. | |
| 59 virtual bool HasResetTrigger(); | |
| 60 | |
| 61 // Returns the name of the tool that performed the reset. This string will be | |
| 62 // truncated to a length of |kMaxToolNameLength|. | |
| 63 virtual base::string16 GetResetToolName(); | |
| 64 | |
| 65 private: | |
| 66 Profile* profile_; | |
| 67 | |
| 68 bool has_reset_trigger_ = false; | |
| 69 | |
| 70 #if DCHECK_IS_ON() | |
|
Alexei Svitkine (slow)
2015/09/14 17:05:43
Nit: I don't think it's worth guarding having this
engedy
2015/09/14 23:28:55
Agreed.
robertshield
2015/09/21 04:16:22
Ack, removed.
robertshield
2015/09/21 04:16:22
Acknowledged.
| |
| 71 bool activate_called_ = false; | |
| 72 #endif | |
| 73 | |
| 74 base::string16 tool_name_; | |
| 75 | |
| 76 DISALLOW_COPY_AND_ASSIGN(TriggeredProfileResetter); | |
| 77 }; | |
| 78 | |
| 79 #endif // CHROME_BROWSER_PROFILE_RESETTER_TRIGGERED_PROFILE_RESETTER_H_ | |
| OLD | NEW |