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

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

Issue 2906103002: Post-cleanup settings reset. (Closed)
Patch Set: Use base::DoNothing 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| that are tagged for
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
64 // Registers the settings reset pending tracked preference.
65 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
66
67 private:
68 // This object doesn't hold any state, so it's safe to delete it even after
69 // an async function is called. For example, it's fine to let the object get
70 // out of scope after invoking ResetTaggedProfiles() and there is no need
71 // to wait for the callback to be run to release it. If you are intending to
72 // change that assumption, please make sure you don't break the contract
73 // where this class is used.
74
75 DISALLOW_COPY_AND_ASSIGN(PostCleanupSettingsResetter);
76 };
77
78 } // namespace safe_browsing
79
80 #endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_SETTINGS_RESETTER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698