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

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: oops 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/threading/non_thread_safe.h" 10 #include "base/threading/non_thread_safe.h"
11 #include "chrome/browser/browsing_data/browsing_data_remover.h" 11 #include "chrome/browser/browsing_data/browsing_data_remover.h"
12 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" 12 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
13 #include "content/public/browser/notification_observer.h" 13 #include "chrome/browser/search_engines/template_url_service.h"
14 #include "content/public/browser/notification_registrar.h"
15 14
16 class Profile; 15 class Profile;
17 class TemplateURLService; 16 class TemplateURLService;
Lei Zhang 2013/10/08 00:25:20 no longer needed since you are including template_
Cait (Slow) 2013/10/08 15:09:32 Done.
18 17
19 // This class allows resetting certain aspects of a profile to default values. 18 // 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 19 // It is used in case the profile has been damaged due to malware or bad user
21 // settings. 20 // settings.
22 class ProfileResetter : public base::NonThreadSafe, 21 class ProfileResetter : public base::NonThreadSafe,
23 public content::NotificationObserver,
24 public BrowsingDataRemover::Observer { 22 public BrowsingDataRemover::Observer {
25 public: 23 public:
26 // Flags indicating what aspects of a profile shall be reset. 24 // Flags indicating what aspects of a profile shall be reset.
27 enum Resettable { 25 enum Resettable {
28 DEFAULT_SEARCH_ENGINE = 1 << 0, 26 DEFAULT_SEARCH_ENGINE = 1 << 0,
29 HOMEPAGE = 1 << 1, 27 HOMEPAGE = 1 << 1,
30 CONTENT_SETTINGS = 1 << 2, 28 CONTENT_SETTINGS = 1 << 2,
31 COOKIES_AND_SITE_DATA = 1 << 3, 29 COOKIES_AND_SITE_DATA = 1 << 3,
32 EXTENSIONS = 1 << 4, 30 EXTENSIONS = 1 << 4,
33 STARTUP_PAGES = 1 << 5, 31 STARTUP_PAGES = 1 << 5,
(...skipping 28 matching lines...) Expand all
62 void MarkAsDone(Resettable resettable); 60 void MarkAsDone(Resettable resettable);
63 61
64 void ResetDefaultSearchEngine(); 62 void ResetDefaultSearchEngine();
65 void ResetHomepage(); 63 void ResetHomepage();
66 void ResetContentSettings(); 64 void ResetContentSettings();
67 void ResetCookiesAndSiteData(); 65 void ResetCookiesAndSiteData();
68 void ResetExtensions(); 66 void ResetExtensions();
69 void ResetStartupPages(); 67 void ResetStartupPages();
70 void ResetPinnedTabs(); 68 void ResetPinnedTabs();
71 69
72 // content::NotificationObserver:
73 virtual void Observe(int type,
74 const content::NotificationSource& source,
75 const content::NotificationDetails& details) OVERRIDE;
76
77 // BrowsingDataRemover::Observer: 70 // BrowsingDataRemover::Observer:
78 virtual void OnBrowsingDataRemoverDone() OVERRIDE; 71 virtual void OnBrowsingDataRemoverDone() OVERRIDE;
79 72
73 // Callback for when TemplateURLService has loaded.
74 void OnTemplateURLServiceLoaded();
75
80 Profile* const profile_; 76 Profile* const profile_;
81 scoped_ptr<BrandcodedDefaultSettings> master_settings_; 77 scoped_ptr<BrandcodedDefaultSettings> master_settings_;
82 TemplateURLService* template_url_service_; 78 TemplateURLService* template_url_service_;
83 79
84 // Flags of a Resetable indicating which reset operations we are still waiting 80 // Flags of a Resetable indicating which reset operations we are still waiting
85 // for. 81 // for.
86 ResettableFlags pending_reset_flags_; 82 ResettableFlags pending_reset_flags_;
87 83
88 // Called on UI thread when reset has been completed. 84 // Called on UI thread when reset has been completed.
89 base::Closure callback_; 85 base::Closure callback_;
90 86
91 content::NotificationRegistrar registrar_;
92
93 // If non-null it means removal is in progress. BrowsingDataRemover takes care 87 // If non-null it means removal is in progress. BrowsingDataRemover takes care
94 // of deleting itself when done. 88 // of deleting itself when done.
95 BrowsingDataRemover* cookies_remover_; 89 BrowsingDataRemover* cookies_remover_;
96 90
91 scoped_ptr<TemplateURLService::Subscription> template_url_service_sub_;
92
97 DISALLOW_COPY_AND_ASSIGN(ProfileResetter); 93 DISALLOW_COPY_AND_ASSIGN(ProfileResetter);
98 }; 94 };
99 95
100 #endif // CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_ 96 #endif // CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698