OLD | NEW |
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 #include "chrome/browser/profile_resetter/profile_resetter.h" | 5 #include "chrome/browser/profile_resetter/profile_resetter.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/google/google_url_tracker.h" | 8 #include "chrome/browser/google/google_url_tracker.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 10 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
11 #include "chrome/browser/search_engines/template_url_service.h" | 11 #include "chrome/browser/search_engines/template_url_service.h" |
12 #include "chrome/browser/search_engines/template_url_service_factory.h" | 12 #include "chrome/browser/search_engines/template_url_service_factory.h" |
13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/notification_source.h" |
16 | 17 |
17 ProfileResetter::ProfileResetter(Profile* profile) | 18 ProfileResetter::ProfileResetter(Profile* profile) |
18 : profile_(profile), | 19 : profile_(profile), |
19 template_url_service_(TemplateURLServiceFactory::GetForProfile(profile_)), | 20 template_url_service_(TemplateURLServiceFactory::GetForProfile(profile_)), |
20 pending_reset_flags_(0) { | 21 pending_reset_flags_(0) { |
21 DCHECK(CalledOnValidThread()); | 22 DCHECK(CalledOnValidThread()); |
22 DCHECK(profile_); | 23 DCHECK(profile_); |
23 DCHECK(template_url_service_); | 24 DCHECK(template_url_service_); |
24 registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, | 25 registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, |
25 content::Source<TemplateURLService>(template_url_service_)); | 26 content::Source<TemplateURLService>(template_url_service_)); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 163 |
163 void ProfileResetter::Observe(int type, | 164 void ProfileResetter::Observe(int type, |
164 const content::NotificationSource& source, | 165 const content::NotificationSource& source, |
165 const content::NotificationDetails& details) { | 166 const content::NotificationDetails& details) { |
166 DCHECK(CalledOnValidThread()); | 167 DCHECK(CalledOnValidThread()); |
167 // TemplateURLService has loaded. If we need to clean search engines, it's | 168 // TemplateURLService has loaded. If we need to clean search engines, it's |
168 // time to go on. | 169 // time to go on. |
169 if (pending_reset_flags_ & DEFAULT_SEARCH_ENGINE) | 170 if (pending_reset_flags_ & DEFAULT_SEARCH_ENGINE) |
170 ResetDefaultSearchEngine(); | 171 ResetDefaultSearchEngine(); |
171 } | 172 } |
OLD | NEW |