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

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

Issue 2906103002: Post-cleanup settings reset. (Closed)
Patch Set: Addressed Robert's comments 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. Non-static members can
28 // only be called if PostCleanupSettingsResetter::IsEnabled() is true.
29 class PostCleanupSettingsResetter {
30 public:
31 class Delegate {
32 public:
33 Delegate();
34 virtual ~Delegate();
35
36 virtual void FetchDefaultSettings(
37 DefaultSettingsFetcher::SettingsCallback callback);
38
39 virtual std::unique_ptr<ProfileResetter> GetProfileResetter(
40 Profile* profile);
41
42 private:
43 DISALLOW_COPY_AND_ASSIGN(Delegate);
44 };
45
46 PostCleanupSettingsResetter();
47 virtual ~PostCleanupSettingsResetter();
48
49 // Returns true if the in-browser cleaner UI is enabled.
50 static bool IsEnabled();
51
52 // Tags |profile| to have its settings reset once the current cleanup
53 // finishes.
54 void TagForResetting(Profile* profile);
55
56 // Resets settings for the profiles in |profiles| there are tagged for
alito 2017/06/13 22:37:49 nit: there -> that
ftirelo 2017/06/13 22:54:39 Done.
57 // resetting if cleanup has completed. Invokes |done_callback| once all
58 // profiles in |profiles| have been reset.
59 void ResetTaggedProfiles(
60 std::vector<Profile*> profiles,
61 base::OnceClosure done_callback,
62 std::unique_ptr<PostCleanupSettingsResetter::Delegate> delegate =
63 nullptr);
64
65 // Registers the settings reset pending tracked preference.
66 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
67
68 private:
69 // This object doesn't hold any state, so it's safe to delete it even after
70 // an async function is called. For example, it's fine to let the object get
71 // out of scope after invoking ResetTaggedProfiles() and there is not need
alito 2017/06/13 22:37:49 nit: not -> no
ftirelo 2017/06/13 22:54:40 Done.
72 // to wait for the callback to be run to release it. If you are intending to
73 // change that assumption, please make sure you don't break the contract
74 // where this class is used.
75
76 DISALLOW_COPY_AND_ASSIGN(PostCleanupSettingsResetter);
77 };
78
79 } // namespace safe_browsing
80
81 #endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_SETTINGS_RESETTER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698