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

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

Issue 23710022: Convert NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED to CallbackList (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean-up Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_ 5 #ifndef CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_
6 #define CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_ 6 #define CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/weak_ptr.h"
Avi (use Gerrit) 2013/10/02 22:27:52 not used; remove.
10 #include "base/threading/non_thread_safe.h" 11 #include "base/threading/non_thread_safe.h"
11 #include "chrome/browser/browsing_data/browsing_data_remover.h" 12 #include "chrome/browser/browsing_data/browsing_data_remover.h"
12 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" 13 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
13 #include "content/public/browser/notification_observer.h" 14 #include "chrome/browser/search_engines/template_url_service.h"
14 #include "content/public/browser/notification_registrar.h"
15 15
16 class Profile; 16 class Profile;
17 class TemplateURLService; 17 class TemplateURLService;
18 18
19 // This class allows resetting certain aspects of a profile to default values. 19 // This class allows resetting certain aspects of a profile to default values.
20 // It is used in case the profile has been damaged due to malware or bad user 20 // It is used in case the profile has been damaged due to malware or bad user
21 // settings. 21 // settings.
22 class ProfileResetter : public base::NonThreadSafe, 22 class ProfileResetter : public base::NonThreadSafe,
23 public content::NotificationObserver,
24 public BrowsingDataRemover::Observer { 23 public BrowsingDataRemover::Observer {
25 public: 24 public:
26 // Flags indicating what aspects of a profile shall be reset. 25 // Flags indicating what aspects of a profile shall be reset.
27 enum Resettable { 26 enum Resettable {
28 DEFAULT_SEARCH_ENGINE = 1 << 0, 27 DEFAULT_SEARCH_ENGINE = 1 << 0,
29 HOMEPAGE = 1 << 1, 28 HOMEPAGE = 1 << 1,
30 CONTENT_SETTINGS = 1 << 2, 29 CONTENT_SETTINGS = 1 << 2,
31 COOKIES_AND_SITE_DATA = 1 << 3, 30 COOKIES_AND_SITE_DATA = 1 << 3,
32 EXTENSIONS = 1 << 4, 31 EXTENSIONS = 1 << 4,
33 STARTUP_PAGES = 1 << 5, 32 STARTUP_PAGES = 1 << 5,
(...skipping 28 matching lines...) Expand all
62 void MarkAsDone(Resettable resettable); 61 void MarkAsDone(Resettable resettable);
63 62
64 void ResetDefaultSearchEngine(); 63 void ResetDefaultSearchEngine();
65 void ResetHomepage(); 64 void ResetHomepage();
66 void ResetContentSettings(); 65 void ResetContentSettings();
67 void ResetCookiesAndSiteData(); 66 void ResetCookiesAndSiteData();
68 void ResetExtensions(); 67 void ResetExtensions();
69 void ResetStartupPages(); 68 void ResetStartupPages();
70 void ResetPinnedTabs(); 69 void ResetPinnedTabs();
71 70
72 // content::NotificationObserver:
73 virtual void Observe(int type,
74 const content::NotificationSource& source,
75 const content::NotificationDetails& details) OVERRIDE;
76
77 // BrowsingDataRemover::Observer: 71 // BrowsingDataRemover::Observer:
78 virtual void OnBrowsingDataRemoverDone() OVERRIDE; 72 virtual void OnBrowsingDataRemoverDone() OVERRIDE;
79 73
74 // Callback for when TemplateURLService has loaded.
75 void OnTemplateURLServiceLoaded();
76
80 Profile* const profile_; 77 Profile* const profile_;
81 scoped_ptr<BrandcodedDefaultSettings> master_settings_; 78 scoped_ptr<BrandcodedDefaultSettings> master_settings_;
82 TemplateURLService* template_url_service_; 79 TemplateURLService* template_url_service_;
83 80
84 // Flags of a Resetable indicating which reset operations we are still waiting 81 // Flags of a Resetable indicating which reset operations we are still waiting
85 // for. 82 // for.
86 ResettableFlags pending_reset_flags_; 83 ResettableFlags pending_reset_flags_;
87 84
88 // Called on UI thread when reset has been completed. 85 // Called on UI thread when reset has been completed.
89 base::Closure callback_; 86 base::Closure callback_;
90 87
91 content::NotificationRegistrar registrar_;
92
93 // If non-null it means removal is in progress. BrowsingDataRemover takes care 88 // If non-null it means removal is in progress. BrowsingDataRemover takes care
94 // of deleting itself when done. 89 // of deleting itself when done.
95 BrowsingDataRemover* cookies_remover_; 90 BrowsingDataRemover* cookies_remover_;
96 91
92 scoped_ptr<TemplateURLService::Subscription> template_url_service_sub_;
93
97 DISALLOW_COPY_AND_ASSIGN(ProfileResetter); 94 DISALLOW_COPY_AND_ASSIGN(ProfileResetter);
98 }; 95 };
99 96
100 #endif // CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_ 97 #endif // CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698