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

Side by Side Diff: chrome/browser/autofill/personal_data_manager.cc

Issue 9169096: Remove a bunch of GetProfileSyncService callers to use the new factory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm todos Created 8 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/autofill/personal_data_manager.h" 5 #include "chrome/browser/autofill/personal_data_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/autofill/autofill-inl.h" 13 #include "chrome/browser/autofill/autofill-inl.h"
14 #include "chrome/browser/autofill/autofill_field.h" 14 #include "chrome/browser/autofill/autofill_field.h"
15 #include "chrome/browser/autofill/autofill_metrics.h" 15 #include "chrome/browser/autofill/autofill_metrics.h"
16 #include "chrome/browser/autofill/autofill_regexes.h" 16 #include "chrome/browser/autofill/autofill_regexes.h"
17 #include "chrome/browser/autofill/form_structure.h" 17 #include "chrome/browser/autofill/form_structure.h"
18 #include "chrome/browser/autofill/personal_data_manager_observer.h" 18 #include "chrome/browser/autofill/personal_data_manager_observer.h"
19 #include "chrome/browser/autofill/phone_number.h" 19 #include "chrome/browser/autofill/phone_number.h"
20 #include "chrome/browser/autofill/phone_number_i18n.h" 20 #include "chrome/browser/autofill/phone_number_i18n.h"
21 #include "chrome/browser/autofill/select_control_handler.h" 21 #include "chrome/browser/autofill/select_control_handler.h"
22 #include "chrome/browser/prefs/pref_service.h" 22 #include "chrome/browser/prefs/pref_service.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/sync/profile_sync_service.h" 24 #include "chrome/browser/sync/profile_sync_service.h"
25 #include "chrome/browser/sync/profile_sync_service_factory.h"
25 #include "chrome/browser/webdata/web_data_service.h" 26 #include "chrome/browser/webdata/web_data_service.h"
26 #include "chrome/common/chrome_notification_types.h" 27 #include "chrome/common/chrome_notification_types.h"
27 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
28 #include "content/public/browser/browser_thread.h" 29 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/notification_source.h" 30 #include "content/public/browser/notification_source.h"
30 31
31 namespace { 32 namespace {
32 33
33 template<typename T> 34 template<typename T>
34 class FormGroupMatchesByGUIDFunctor { 35 class FormGroupMatchesByGUIDFunctor {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if (!profile_ || profile_->IsOffTheRecord()) 184 if (!profile_ || profile_->IsOffTheRecord())
184 return; 185 return;
185 186
186 WebDataService* web_data_service = 187 WebDataService* web_data_service =
187 profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); 188 profile_->GetWebDataService(Profile::EXPLICIT_ACCESS);
188 if (!web_data_service) { 189 if (!web_data_service) {
189 NOTREACHED(); 190 NOTREACHED();
190 return; 191 return;
191 } 192 }
192 193
193 ProfileSyncService* sync_service = profile_->GetProfileSyncService(); 194 ProfileSyncService* sync_service =
195 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_);
194 if (!sync_service) 196 if (!sync_service)
195 return; 197 return;
196 198
197 if (sync_service->ShouldPushChanges()) { 199 if (sync_service->ShouldPushChanges()) {
198 web_data_service->EmptyMigrationTrash(true); 200 web_data_service->EmptyMigrationTrash(true);
199 sync_service->RemoveObserver(this); 201 sync_service->RemoveObserver(this);
200 } 202 }
201 } 203 }
202 204
203 void PersonalDataManager::Shutdown() { 205 void PersonalDataManager::Shutdown() {
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 if (!profile_ || profile_->IsOffTheRecord()) 885 if (!profile_ || profile_->IsOffTheRecord())
884 return; 886 return;
885 887
886 WebDataService* web_data_service = 888 WebDataService* web_data_service =
887 profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); 889 profile_->GetWebDataService(Profile::EXPLICIT_ACCESS);
888 if (!web_data_service) { 890 if (!web_data_service) {
889 NOTREACHED(); 891 NOTREACHED();
890 return; 892 return;
891 } 893 }
892 894
893 ProfileSyncService* sync_service = profile_->GetProfileSyncService(); 895 ProfileSyncService* sync_service =
896 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_);
894 if (!sync_service) 897 if (!sync_service)
895 return; 898 return;
896 899
897 if (!sync_service->HasSyncSetupCompleted()) { 900 if (!sync_service->HasSyncSetupCompleted()) {
898 web_data_service->EmptyMigrationTrash(false); 901 web_data_service->EmptyMigrationTrash(false);
899 } else if (sync_service->ShouldPushChanges()) { 902 } else if (sync_service->ShouldPushChanges()) {
900 web_data_service->EmptyMigrationTrash(true); 903 web_data_service->EmptyMigrationTrash(true);
901 } else { 904 } else {
902 // Install ourself as a listener so we can empty the trash once the 905 // Install ourself as a listener so we can empty the trash once the
903 // sync service becomes available. 906 // sync service becomes available.
(...skipping 10 matching lines...) Expand all
914 } 917 }
915 918
916 const AutofillMetrics* PersonalDataManager::metric_logger() const { 919 const AutofillMetrics* PersonalDataManager::metric_logger() const {
917 return metric_logger_.get(); 920 return metric_logger_.get();
918 } 921 }
919 922
920 void PersonalDataManager::set_metric_logger( 923 void PersonalDataManager::set_metric_logger(
921 const AutofillMetrics* metric_logger) { 924 const AutofillMetrics* metric_logger) {
922 metric_logger_.reset(metric_logger); 925 metric_logger_.reset(metric_logger);
923 } 926 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698