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

Side by Side Diff: chrome/browser/safe_browsing/chrome_cleaner/settings_resetter_win.h

Issue 2906103002: Post-cleanup settings reset. (Closed)
Patch Set: Code reviews Created 3 years, 6 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 2017 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_SAFE_BROWSING_CHROME_CLEANER_SETTINGS_RESETTER_WIN_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_SETTINGS_RESETTER_WIN_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "base/macros.h"
13 #include "chrome/browser/safe_browsing/settings_reset_prompt/default_settings_fe tcher.h"
14
15 class Profile;
16 class ProfileResetter;
17
18 namespace user_prefs {
19 class PrefRegistrySyncable;
20 } // namespace user_prefs
21
22 namespace safe_browsing {
23
24 // Handles settings reset for user's profile to complete a Chrome Cleaner run.
25 // Allows tagging a profile for resetting once a cleanup starts and resetting
26 // settings once a cleanup is completed. Completed cleanup is identified by
27 // annotations in the registry written by the cleaner.
28 class PostCleanupSettingsResetter {
29 public:
30 class Delegate {
31 public:
32 Delegate();
33 virtual ~Delegate();
34
35 virtual void FetchDefaultSettings(
36 DefaultSettingsFetcher::SettingsCallback callback);
37
38 virtual std::unique_ptr<ProfileResetter> GetProfileResetter(
39 Profile* profile);
40
41 private:
42 DISALLOW_COPY_AND_ASSIGN(Delegate);
43 };
44
45 // Factory method for this class. Returns null if post-cleanup settings reset
46 // is disabled.
robertshield 2017/06/12 15:00:04 Why does this class need a factory method? It look
ftirelo 2017/06/13 18:52:49 Done.
47 static std::unique_ptr<PostCleanupSettingsResetter> Create();
48
49 // Tags |profile| to have its settings reset once the current cleanup
50 // finishes. It's safe to delete the current object once this function
51 // returns.
robertshield 2017/06/12 15:00:04 Furthermore, if callers create these things on the
ftirelo 2017/06/13 18:52:49 Done.
52 void TagForResetting(Profile* profile);
53
54 // Resets settings for the profiles in |profiles| there are tagged for
55 // resetting if cleanup has completed. Invokes |continuation| once all
56 // profiles is |profiles| have been reset. It's safe to delete this
robertshield 2017/06/12 15:00:04 s/is/in/
ftirelo 2017/06/13 18:52:49 Done.
57 // object once this function returns.
58 void ResetTaggedProfiles(
59 std::vector<Profile*> profiles,
60 base::OnceClosure continuation,
61 std::unique_ptr<PostCleanupSettingsResetter::Delegate> delegate =
62 nullptr);
63
64 // Registers the settings reset pending tracked preference.
65 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
66
67 protected:
68 PostCleanupSettingsResetter();
69
70 private:
71 // This object doesn't hold any state, so it's safe to delete it even after
72 // an async function is called. For example, it's fine to let the object get
73 // out of scope after invoking ResetTaggedProfiles() and there is not need
74 // to wait for the callback to be run to release it. If you are intending to
75 // change that assumption, please make sure you don't break the contract
76 // where this class is used.
77
78 DISALLOW_COPY_AND_ASSIGN(PostCleanupSettingsResetter);
79 };
80
81 } // namespace safe_browsing
82
83 #endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_SETTINGS_RESETTER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698