Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/api/prefs/pref_service_base.h" | 22 #include "chrome/browser/api/prefs/pref_service_base.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/sync/profile_sync_service_factory.h" |
| 26 #include "chrome/browser/webdata/autofill_entry.h" | |
| 27 #include "chrome/browser/webdata/web_data_service.h" | |
| 28 #include "chrome/browser/webdata/web_data_service_factory.h" | |
| 29 #include "chrome/common/chrome_notification_types.h" | 26 #include "chrome/common/chrome_notification_types.h" |
| 30 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 31 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 32 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
| 33 | 30 |
| 34 namespace { | 31 namespace { |
| 35 | 32 |
| 36 template<typename T> | 33 template<typename T> |
| 37 class FormGroupMatchesByGUIDFunctor { | 34 class FormGroupMatchesByGUIDFunctor { |
| 38 public: | 35 public: |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 } | 117 } |
| 121 | 118 |
| 122 } // namespace | 119 } // namespace |
| 123 | 120 |
| 124 PersonalDataManager::~PersonalDataManager() { | 121 PersonalDataManager::~PersonalDataManager() { |
| 125 CancelPendingQuery(&pending_profiles_query_); | 122 CancelPendingQuery(&pending_profiles_query_); |
| 126 CancelPendingQuery(&pending_creditcards_query_); | 123 CancelPendingQuery(&pending_creditcards_query_); |
| 127 } | 124 } |
| 128 | 125 |
| 129 void PersonalDataManager::OnWebDataServiceRequestDone( | 126 void PersonalDataManager::OnWebDataServiceRequestDone( |
| 130 WebDataService::Handle h, | 127 WebDataServiceBase::Handle h, |
| 131 const WDTypedResult* result) { | 128 const WDTypedResult* result) { |
| 132 DCHECK(pending_profiles_query_ || pending_creditcards_query_); | 129 DCHECK(pending_profiles_query_ || pending_creditcards_query_); |
| 133 | 130 |
| 134 if (!result) { | 131 if (!result) { |
| 135 // Error from the web database. | 132 // Error from the web database. |
| 136 if (h == pending_creditcards_query_) | 133 if (h == pending_creditcards_query_) |
| 137 pending_creditcards_query_ = 0; | 134 pending_creditcards_query_ = 0; |
| 138 else if (h == pending_profiles_query_) | 135 else if (h == pending_profiles_query_) |
| 139 pending_profiles_query_ = 0; | 136 pending_profiles_query_ = 0; |
| 140 return; | 137 return; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 165 OnPersonalDataChanged()); | 162 OnPersonalDataChanged()); |
| 166 | 163 |
| 167 // As all Autofill data is ready, the Autocomplete data is ready as well. | 164 // As all Autofill data is ready, the Autocomplete data is ready as well. |
| 168 // If sync is not set, cull older entries of the autocomplete. Otherwise, | 165 // If sync is not set, cull older entries of the autocomplete. Otherwise, |
| 169 // the entries will be culled when sync is connected. | 166 // the entries will be culled when sync is connected. |
| 170 ProfileSyncService* sync_service = | 167 ProfileSyncService* sync_service = |
| 171 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); | 168 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); |
| 172 if (sync_service && (!sync_service->HasSyncSetupCompleted() || | 169 if (sync_service && (!sync_service->HasSyncSetupCompleted() || |
| 173 !PrefServiceBase::ForProfile(profile_)->GetBoolean( | 170 !PrefServiceBase::ForProfile(profile_)->GetBoolean( |
| 174 prefs::kSyncAutofill))) { | 171 prefs::kSyncAutofill))) { |
| 175 scoped_refptr<WebDataService> web_data_service = | 172 scoped_ptr<AutofillWebDataService> service = |
|
erikwright (departed)
2012/09/13 01:45:11
I think constructor semantics are preferred here.
Jói
2012/09/13 12:34:50
Done.
| |
| 176 WebDataServiceFactory::GetForProfile(profile_, | 173 AutofillWebDataService::ForContext(profile_); |
| 177 Profile::EXPLICIT_ACCESS); | 174 if (service.get()) |
| 178 if (web_data_service) | 175 service->RemoveExpiredFormElements(); |
| 179 web_data_service->RemoveExpiredFormElements(); | |
| 180 } | 176 } |
| 181 } | 177 } |
| 182 } | 178 } |
| 183 | 179 |
| 184 void PersonalDataManager::SetObserver(PersonalDataManagerObserver* observer) { | 180 void PersonalDataManager::SetObserver(PersonalDataManagerObserver* observer) { |
| 185 // TODO(dhollowa): RemoveObserver is for compatibility with old code, it | 181 // TODO(dhollowa): RemoveObserver is for compatibility with old code, it |
| 186 // should be nuked. | 182 // should be nuked. |
| 187 observers_.RemoveObserver(observer); | 183 observers_.RemoveObserver(observer); |
| 188 observers_.AddObserver(observer); | 184 observers_.AddObserver(observer); |
| 189 } | 185 } |
| 190 | 186 |
| 191 void PersonalDataManager::RemoveObserver( | 187 void PersonalDataManager::RemoveObserver( |
| 192 PersonalDataManagerObserver* observer) { | 188 PersonalDataManagerObserver* observer) { |
| 193 observers_.RemoveObserver(observer); | 189 observers_.RemoveObserver(observer); |
| 194 } | 190 } |
| 195 | 191 |
| 196 // The |PersonalDataManager| is set up as a listener of the sync service in | 192 // The |PersonalDataManager| is set up as a listener of the sync service in |
| 197 // |EmptyMigrationTrash| in the case where sync is not yet ready to receive | 193 // |EmptyMigrationTrash| in the case where sync is not yet ready to receive |
| 198 // changes. This method, |OnStateChange| acts as a deferred call to | 194 // changes. This method, |OnStateChange| acts as a deferred call to |
| 199 // |EmptyMigrationTrash| once the sync service becomes available. | 195 // |EmptyMigrationTrash| once the sync service becomes available. |
| 200 void PersonalDataManager::OnStateChanged() { | 196 void PersonalDataManager::OnStateChanged() { |
| 201 if (!profile_ || profile_->IsOffTheRecord()) | 197 if (!profile_ || profile_->IsOffTheRecord()) |
| 202 return; | 198 return; |
| 203 | 199 |
| 204 scoped_refptr<WebDataService> web_data_service = | 200 scoped_ptr<AutofillWebDataService> autofill_data = |
|
erikwright (departed)
2012/09/13 01:45:11
ditto.
Jói
2012/09/13 12:34:50
Done.
| |
| 205 WebDataServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 201 AutofillWebDataService::ForContext(profile_); |
| 206 if (!web_data_service.get()) { | 202 if (!autofill_data.get()) { |
| 207 NOTREACHED(); | 203 NOTREACHED(); |
| 208 return; | 204 return; |
| 209 } | 205 } |
| 210 | 206 |
| 211 ProfileSyncService* sync_service = | 207 ProfileSyncService* sync_service = |
| 212 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); | 208 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); |
| 213 if (!sync_service) | 209 if (!sync_service) |
| 214 return; | 210 return; |
| 215 | 211 |
| 216 if (sync_service->ShouldPushChanges()) { | 212 if (sync_service->ShouldPushChanges()) { |
| 217 web_data_service->EmptyMigrationTrash(true); | 213 autofill_data->EmptyMigrationTrash(true); |
| 218 sync_service->RemoveObserver(this); | 214 sync_service->RemoveObserver(this); |
| 219 } | 215 } |
| 220 } | 216 } |
| 221 | 217 |
| 222 void PersonalDataManager::Shutdown() { | 218 void PersonalDataManager::Shutdown() { |
| 223 CancelPendingQuery(&pending_profiles_query_); | 219 CancelPendingQuery(&pending_profiles_query_); |
| 224 CancelPendingQuery(&pending_creditcards_query_); | 220 CancelPendingQuery(&pending_creditcards_query_); |
| 225 notification_registrar_.RemoveAll(); | 221 notification_registrar_.RemoveAll(); |
| 226 } | 222 } |
| 227 | 223 |
| 228 void PersonalDataManager::Observe(int type, | 224 void PersonalDataManager::Observe(int type, |
| 229 const content::NotificationSource& source, | 225 const content::NotificationSource& source, |
| 230 const content::NotificationDetails& details) { | 226 const content::NotificationDetails& details) { |
| 231 DCHECK_EQ(type, chrome::NOTIFICATION_AUTOFILL_MULTIPLE_CHANGED); | 227 DCHECK_EQ(type, chrome::NOTIFICATION_AUTOFILL_MULTIPLE_CHANGED); |
| 232 scoped_refptr<WebDataService> web_data_service = | |
| 233 content::Source<WebDataService>(source).ptr(); | |
| 234 | 228 |
| 235 DCHECK(web_data_service.get() && | 229 WebDataServiceBase* notification_source = |
|
erikwright (departed)
2012/09/13 01:45:11
Arguably lines 229 to 236 should be in some kind o
Jói
2012/09/13 12:34:50
Done.
| |
| 236 web_data_service.get() == WebDataServiceFactory::GetForProfile( | 230 content::Source<WebDataServiceBase>(source).ptr(); |
| 237 profile_, Profile::EXPLICIT_ACCESS).get()); | 231 |
| 232 scoped_ptr<AutofillWebDataService> autofill_data = | |
|
erikwright (departed)
2012/09/13 01:45:11
constructor semantics.
Jói
2012/09/13 12:34:50
Done.
| |
| 233 AutofillWebDataService::ForContext(profile_); | |
| 234 | |
| 235 DCHECK(autofill_data.get() && | |
| 236 autofill_data->GetNotificationSource() == notification_source); | |
| 238 Refresh(); | 237 Refresh(); |
| 239 } | 238 } |
| 240 | 239 |
| 241 bool PersonalDataManager::ImportFormData( | 240 bool PersonalDataManager::ImportFormData( |
| 242 const FormStructure& form, | 241 const FormStructure& form, |
| 243 const CreditCard** imported_credit_card) { | 242 const CreditCard** imported_credit_card) { |
| 244 scoped_ptr<AutofillProfile> imported_profile(new AutofillProfile); | 243 scoped_ptr<AutofillProfile> imported_profile(new AutofillProfile); |
| 245 scoped_ptr<CreditCard> local_imported_credit_card(new CreditCard); | 244 scoped_ptr<CreditCard> local_imported_credit_card(new CreditCard); |
| 246 | 245 |
| 247 // Parse the form and construct a profile based on the information that is | 246 // Parse the form and construct a profile based on the information that is |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 if (profile_->IsOffTheRecord()) | 359 if (profile_->IsOffTheRecord()) |
| 361 return; | 360 return; |
| 362 | 361 |
| 363 if (profile.IsEmpty()) | 362 if (profile.IsEmpty()) |
| 364 return; | 363 return; |
| 365 | 364 |
| 366 // Don't add an existing profile. | 365 // Don't add an existing profile. |
| 367 if (FindByGUID<AutofillProfile>(web_profiles_, profile.guid())) | 366 if (FindByGUID<AutofillProfile>(web_profiles_, profile.guid())) |
| 368 return; | 367 return; |
| 369 | 368 |
| 370 scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( | 369 scoped_ptr<AutofillWebDataService> autofill_data = |
|
erikwright (departed)
2012/09/13 01:45:11
ditto.
Jói
2012/09/13 12:34:50
Done.
| |
| 371 profile_, Profile::EXPLICIT_ACCESS); | 370 AutofillWebDataService::ForContext(profile_); |
| 372 if (!wds.get()) | 371 if (!autofill_data.get()) |
| 373 return; | 372 return; |
| 374 | 373 |
| 375 // Don't add a duplicate. | 374 // Don't add a duplicate. |
| 376 if (FindByContents(web_profiles_, profile)) | 375 if (FindByContents(web_profiles_, profile)) |
| 377 return; | 376 return; |
| 378 | 377 |
| 379 // Add the new profile to the web database. | 378 // Add the new profile to the web database. |
| 380 wds->AddAutofillProfile(profile); | 379 autofill_data->AddAutofillProfile(profile); |
| 381 | 380 |
| 382 // Refresh our local cache and send notifications to observers. | 381 // Refresh our local cache and send notifications to observers. |
| 383 Refresh(); | 382 Refresh(); |
| 384 } | 383 } |
| 385 | 384 |
| 386 void PersonalDataManager::UpdateProfile(const AutofillProfile& profile) { | 385 void PersonalDataManager::UpdateProfile(const AutofillProfile& profile) { |
| 387 if (profile_->IsOffTheRecord()) | 386 if (profile_->IsOffTheRecord()) |
| 388 return; | 387 return; |
| 389 | 388 |
| 390 if (!FindByGUID<AutofillProfile>(web_profiles_, profile.guid())) | 389 if (!FindByGUID<AutofillProfile>(web_profiles_, profile.guid())) |
| 391 return; | 390 return; |
| 392 | 391 |
| 393 if (profile.IsEmpty()) { | 392 if (profile.IsEmpty()) { |
| 394 RemoveProfile(profile.guid()); | 393 RemoveProfile(profile.guid()); |
| 395 return; | 394 return; |
| 396 } | 395 } |
| 397 | 396 |
| 398 scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( | 397 scoped_ptr<AutofillWebDataService> autofill_data = |
|
erikwright (departed)
2012/09/13 01:45:11
ditto.
Jói
2012/09/13 12:34:50
Done.
| |
| 399 profile_, Profile::EXPLICIT_ACCESS); | 398 AutofillWebDataService::ForContext(profile_); |
| 400 if (!wds.get()) | 399 if (!autofill_data.get()) |
| 401 return; | 400 return; |
| 402 | 401 |
| 403 // Make the update. | 402 // Make the update. |
| 404 wds->UpdateAutofillProfile(profile); | 403 autofill_data->UpdateAutofillProfile(profile); |
| 405 | 404 |
| 406 // Refresh our local cache and send notifications to observers. | 405 // Refresh our local cache and send notifications to observers. |
| 407 Refresh(); | 406 Refresh(); |
| 408 } | 407 } |
| 409 | 408 |
| 410 void PersonalDataManager::RemoveProfile(const std::string& guid) { | 409 void PersonalDataManager::RemoveProfile(const std::string& guid) { |
| 411 if (profile_->IsOffTheRecord()) | 410 if (profile_->IsOffTheRecord()) |
| 412 return; | 411 return; |
| 413 | 412 |
| 414 if (!FindByGUID<AutofillProfile>(web_profiles_, guid)) | 413 if (!FindByGUID<AutofillProfile>(web_profiles_, guid)) |
| 415 return; | 414 return; |
| 416 | 415 |
| 417 scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( | 416 scoped_ptr<AutofillWebDataService> autofill_data = |
|
erikwright (departed)
2012/09/13 01:45:11
ditto.
Jói
2012/09/13 12:34:50
Done.
| |
| 418 profile_, Profile::EXPLICIT_ACCESS); | 417 AutofillWebDataService::ForContext(profile_); |
| 419 if (!wds.get()) | 418 if (!autofill_data.get()) |
| 420 return; | 419 return; |
| 421 | 420 |
| 422 // Remove the profile. | 421 // Remove the profile. |
| 423 wds->RemoveAutofillProfile(guid); | 422 autofill_data->RemoveAutofillProfile(guid); |
| 424 | 423 |
| 425 // Refresh our local cache and send notifications to observers. | 424 // Refresh our local cache and send notifications to observers. |
| 426 Refresh(); | 425 Refresh(); |
| 427 } | 426 } |
| 428 | 427 |
| 429 AutofillProfile* PersonalDataManager::GetProfileByGUID( | 428 AutofillProfile* PersonalDataManager::GetProfileByGUID( |
| 430 const std::string& guid) { | 429 const std::string& guid) { |
| 431 for (std::vector<AutofillProfile*>::iterator iter = web_profiles_.begin(); | 430 for (std::vector<AutofillProfile*>::iterator iter = web_profiles_.begin(); |
| 432 iter != web_profiles_.end(); ++iter) { | 431 iter != web_profiles_.end(); ++iter) { |
| 433 if ((*iter)->guid() == guid) | 432 if ((*iter)->guid() == guid) |
| 434 return *iter; | 433 return *iter; |
| 435 } | 434 } |
| 436 return NULL; | 435 return NULL; |
| 437 } | 436 } |
| 438 | 437 |
| 439 void PersonalDataManager::AddCreditCard(const CreditCard& credit_card) { | 438 void PersonalDataManager::AddCreditCard(const CreditCard& credit_card) { |
| 440 if (profile_->IsOffTheRecord()) | 439 if (profile_->IsOffTheRecord()) |
| 441 return; | 440 return; |
| 442 | 441 |
| 443 if (credit_card.IsEmpty()) | 442 if (credit_card.IsEmpty()) |
| 444 return; | 443 return; |
| 445 | 444 |
| 446 if (FindByGUID<CreditCard>(credit_cards_, credit_card.guid())) | 445 if (FindByGUID<CreditCard>(credit_cards_, credit_card.guid())) |
| 447 return; | 446 return; |
| 448 | 447 |
| 449 scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( | 448 scoped_ptr<AutofillWebDataService> autofill_data = |
|
erikwright (departed)
2012/09/13 01:45:11
ditto.
Jói
2012/09/13 12:34:50
Done.
| |
| 450 profile_, Profile::EXPLICIT_ACCESS); | 449 AutofillWebDataService::ForContext(profile_); |
| 451 if (!wds.get()) | 450 if (!autofill_data.get()) |
| 452 return; | 451 return; |
| 453 | 452 |
| 454 // Don't add a duplicate. | 453 // Don't add a duplicate. |
| 455 if (FindByContents(credit_cards_, credit_card)) | 454 if (FindByContents(credit_cards_, credit_card)) |
| 456 return; | 455 return; |
| 457 | 456 |
| 458 // Add the new credit card to the web database. | 457 // Add the new credit card to the web database. |
| 459 wds->AddCreditCard(credit_card); | 458 autofill_data->AddCreditCard(credit_card); |
| 460 | 459 |
| 461 // Refresh our local cache and send notifications to observers. | 460 // Refresh our local cache and send notifications to observers. |
| 462 Refresh(); | 461 Refresh(); |
| 463 } | 462 } |
| 464 | 463 |
| 465 void PersonalDataManager::UpdateCreditCard(const CreditCard& credit_card) { | 464 void PersonalDataManager::UpdateCreditCard(const CreditCard& credit_card) { |
| 466 if (profile_->IsOffTheRecord()) | 465 if (profile_->IsOffTheRecord()) |
| 467 return; | 466 return; |
| 468 | 467 |
| 469 if (!FindByGUID<CreditCard>(credit_cards_, credit_card.guid())) | 468 if (!FindByGUID<CreditCard>(credit_cards_, credit_card.guid())) |
| 470 return; | 469 return; |
| 471 | 470 |
| 472 if (credit_card.IsEmpty()) { | 471 if (credit_card.IsEmpty()) { |
| 473 RemoveCreditCard(credit_card.guid()); | 472 RemoveCreditCard(credit_card.guid()); |
| 474 return; | 473 return; |
| 475 } | 474 } |
| 476 | 475 |
| 477 scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( | 476 scoped_ptr<AutofillWebDataService> autofill_data = |
|
erikwright (departed)
2012/09/13 01:45:11
etc. and below.
Jói
2012/09/13 12:34:50
Done.
| |
| 478 profile_, Profile::EXPLICIT_ACCESS); | 477 AutofillWebDataService::ForContext(profile_); |
| 479 if (!wds.get()) | 478 if (!autofill_data.get()) |
| 480 return; | 479 return; |
| 481 | 480 |
| 482 // Make the update. | 481 // Make the update. |
| 483 wds->UpdateCreditCard(credit_card); | 482 autofill_data->UpdateCreditCard(credit_card); |
| 484 | 483 |
| 485 // Refresh our local cache and send notifications to observers. | 484 // Refresh our local cache and send notifications to observers. |
| 486 Refresh(); | 485 Refresh(); |
| 487 } | 486 } |
| 488 | 487 |
| 489 void PersonalDataManager::RemoveCreditCard(const std::string& guid) { | 488 void PersonalDataManager::RemoveCreditCard(const std::string& guid) { |
| 490 if (profile_->IsOffTheRecord()) | 489 if (profile_->IsOffTheRecord()) |
| 491 return; | 490 return; |
| 492 | 491 |
| 493 if (!FindByGUID<CreditCard>(credit_cards_, guid)) | 492 if (!FindByGUID<CreditCard>(credit_cards_, guid)) |
| 494 return; | 493 return; |
| 495 | 494 |
| 496 scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( | 495 scoped_ptr<AutofillWebDataService> autofill_data = |
| 497 profile_, Profile::EXPLICIT_ACCESS); | 496 AutofillWebDataService::ForContext(profile_); |
| 498 if (!wds.get()) | 497 if (!autofill_data.get()) |
| 499 return; | 498 return; |
| 500 | 499 |
| 501 // Remove the credit card. | 500 // Remove the credit card. |
| 502 wds->RemoveCreditCard(guid); | 501 autofill_data->RemoveCreditCard(guid); |
| 503 | 502 |
| 504 // Refresh our local cache and send notifications to observers. | 503 // Refresh our local cache and send notifications to observers. |
| 505 Refresh(); | 504 Refresh(); |
| 506 } | 505 } |
| 507 | 506 |
| 508 CreditCard* PersonalDataManager::GetCreditCardByGUID(const std::string& guid) { | 507 CreditCard* PersonalDataManager::GetCreditCardByGUID(const std::string& guid) { |
| 509 for (std::vector<CreditCard*>::iterator iter = credit_cards_.begin(); | 508 for (std::vector<CreditCard*>::iterator iter = credit_cards_.begin(); |
| 510 iter != credit_cards_.end(); ++iter) { | 509 iter != credit_cards_.end(); ++iter) { |
| 511 if ((*iter)->guid() == guid) | 510 if ((*iter)->guid() == guid) |
| 512 return *iter; | 511 return *iter; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 576 pending_creditcards_query_(0), | 575 pending_creditcards_query_(0), |
| 577 metric_logger_(new AutofillMetrics), | 576 metric_logger_(new AutofillMetrics), |
| 578 has_logged_profile_count_(false) { | 577 has_logged_profile_count_(false) { |
| 579 } | 578 } |
| 580 | 579 |
| 581 void PersonalDataManager::Init(Profile* profile) { | 580 void PersonalDataManager::Init(Profile* profile) { |
| 582 profile_ = profile; | 581 profile_ = profile; |
| 583 metric_logger_->LogIsAutofillEnabledAtStartup(IsAutofillEnabled()); | 582 metric_logger_->LogIsAutofillEnabledAtStartup(IsAutofillEnabled()); |
| 584 | 583 |
| 585 // WebDataService may not be available in tests. | 584 // WebDataService may not be available in tests. |
| 586 scoped_refptr<WebDataService> web_data_service = | 585 scoped_ptr<AutofillWebDataService> autofill_data = |
| 587 WebDataServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 586 AutofillWebDataService::ForContext(profile_); |
| 588 if (!web_data_service.get()) | 587 if (!autofill_data.get()) |
| 589 return; | 588 return; |
| 590 | 589 |
| 591 LoadProfiles(); | 590 LoadProfiles(); |
| 592 LoadCreditCards(); | 591 LoadCreditCards(); |
| 593 | 592 |
| 594 notification_registrar_.Add( | 593 notification_registrar_.Add( |
| 595 this, | 594 this, |
| 596 chrome::NOTIFICATION_AUTOFILL_MULTIPLE_CHANGED, | 595 chrome::NOTIFICATION_AUTOFILL_MULTIPLE_CHANGED, |
| 597 content::Source<WebDataService>(web_data_service)); | 596 content::Source<WebDataServiceBase>( |
| 597 autofill_data->GetNotificationSource())); | |
| 598 } | 598 } |
| 599 | 599 |
| 600 bool PersonalDataManager::IsAutofillEnabled() const { | 600 bool PersonalDataManager::IsAutofillEnabled() const { |
| 601 return PrefServiceBase::ForProfile(profile_)->GetBoolean( | 601 return PrefServiceBase::ForProfile(profile_)->GetBoolean( |
| 602 prefs::kAutofillEnabled); | 602 prefs::kAutofillEnabled); |
| 603 } | 603 } |
| 604 | 604 |
| 605 // static | 605 // static |
| 606 bool PersonalDataManager::IsValidLearnableProfile( | 606 bool PersonalDataManager::IsValidLearnableProfile( |
| 607 const AutofillProfile& profile) { | 607 const AutofillProfile& profile) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 672 | 672 |
| 673 // Ensure that profile labels are up to date. Currently, sync relies on | 673 // Ensure that profile labels are up to date. Currently, sync relies on |
| 674 // labels to identify a profile. | 674 // labels to identify a profile. |
| 675 // TODO(dhollowa): We need to deprecate labels and update the way sync | 675 // TODO(dhollowa): We need to deprecate labels and update the way sync |
| 676 // identifies profiles. | 676 // identifies profiles. |
| 677 std::vector<AutofillProfile*> profile_pointers(profiles->size()); | 677 std::vector<AutofillProfile*> profile_pointers(profiles->size()); |
| 678 std::transform(profiles->begin(), profiles->end(), profile_pointers.begin(), | 678 std::transform(profiles->begin(), profiles->end(), profile_pointers.begin(), |
| 679 address_of<AutofillProfile>); | 679 address_of<AutofillProfile>); |
| 680 AutofillProfile::AdjustInferredLabels(&profile_pointers); | 680 AutofillProfile::AdjustInferredLabels(&profile_pointers); |
| 681 | 681 |
| 682 scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( | 682 scoped_ptr<AutofillWebDataService> autofill_data = |
| 683 profile_, Profile::EXPLICIT_ACCESS); | 683 AutofillWebDataService::ForContext(profile_); |
| 684 if (!wds.get()) | 684 if (!autofill_data.get()) |
| 685 return; | 685 return; |
| 686 | 686 |
| 687 // Any profiles that are not in the new profile list should be removed from | 687 // Any profiles that are not in the new profile list should be removed from |
| 688 // the web database. | 688 // the web database. |
| 689 for (std::vector<AutofillProfile*>::const_iterator iter = | 689 for (std::vector<AutofillProfile*>::const_iterator iter = |
| 690 web_profiles_.begin(); | 690 web_profiles_.begin(); |
| 691 iter != web_profiles_.end(); ++iter) { | 691 iter != web_profiles_.end(); ++iter) { |
| 692 if (!FindByGUID<AutofillProfile>(*profiles, (*iter)->guid())) | 692 if (!FindByGUID<AutofillProfile>(*profiles, (*iter)->guid())) |
| 693 wds->RemoveAutofillProfile((*iter)->guid()); | 693 autofill_data->RemoveAutofillProfile((*iter)->guid()); |
| 694 } | 694 } |
| 695 | 695 |
| 696 // Update the web database with the existing profiles. | 696 // Update the web database with the existing profiles. |
| 697 for (std::vector<AutofillProfile>::iterator iter = profiles->begin(); | 697 for (std::vector<AutofillProfile>::iterator iter = profiles->begin(); |
| 698 iter != profiles->end(); ++iter) { | 698 iter != profiles->end(); ++iter) { |
| 699 if (FindByGUID<AutofillProfile>(web_profiles_, iter->guid())) | 699 if (FindByGUID<AutofillProfile>(web_profiles_, iter->guid())) |
| 700 wds->UpdateAutofillProfile(*iter); | 700 autofill_data->UpdateAutofillProfile(*iter); |
| 701 } | 701 } |
| 702 | 702 |
| 703 // Add the new profiles to the web database. Don't add a duplicate. | 703 // Add the new profiles to the web database. Don't add a duplicate. |
| 704 for (std::vector<AutofillProfile>::iterator iter = profiles->begin(); | 704 for (std::vector<AutofillProfile>::iterator iter = profiles->begin(); |
| 705 iter != profiles->end(); ++iter) { | 705 iter != profiles->end(); ++iter) { |
| 706 if (!FindByGUID<AutofillProfile>(web_profiles_, iter->guid()) && | 706 if (!FindByGUID<AutofillProfile>(web_profiles_, iter->guid()) && |
| 707 !FindByContents(web_profiles_, *iter)) | 707 !FindByContents(web_profiles_, *iter)) |
| 708 wds->AddAutofillProfile(*iter); | 708 autofill_data->AddAutofillProfile(*iter); |
| 709 } | 709 } |
| 710 | 710 |
| 711 // Copy in the new profiles. | 711 // Copy in the new profiles. |
| 712 web_profiles_.clear(); | 712 web_profiles_.clear(); |
| 713 for (std::vector<AutofillProfile>::iterator iter = profiles->begin(); | 713 for (std::vector<AutofillProfile>::iterator iter = profiles->begin(); |
| 714 iter != profiles->end(); ++iter) { | 714 iter != profiles->end(); ++iter) { |
| 715 web_profiles_.push_back(new AutofillProfile(*iter)); | 715 web_profiles_.push_back(new AutofillProfile(*iter)); |
| 716 } | 716 } |
| 717 | 717 |
| 718 // Refresh our local cache and send notifications to observers. | 718 // Refresh our local cache and send notifications to observers. |
| 719 Refresh(); | 719 Refresh(); |
| 720 } | 720 } |
| 721 | 721 |
| 722 void PersonalDataManager::SetCreditCards( | 722 void PersonalDataManager::SetCreditCards( |
| 723 std::vector<CreditCard>* credit_cards) { | 723 std::vector<CreditCard>* credit_cards) { |
| 724 if (profile_->IsOffTheRecord()) | 724 if (profile_->IsOffTheRecord()) |
| 725 return; | 725 return; |
| 726 | 726 |
| 727 // Remove empty credit cards from input. | 727 // Remove empty credit cards from input. |
| 728 credit_cards->erase( | 728 credit_cards->erase( |
| 729 std::remove_if( | 729 std::remove_if( |
| 730 credit_cards->begin(), credit_cards->end(), | 730 credit_cards->begin(), credit_cards->end(), |
| 731 std::mem_fun_ref(&CreditCard::IsEmpty)), | 731 std::mem_fun_ref(&CreditCard::IsEmpty)), |
| 732 credit_cards->end()); | 732 credit_cards->end()); |
| 733 | 733 |
| 734 scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( | 734 scoped_ptr<AutofillWebDataService> autofill_data = |
| 735 profile_, Profile::EXPLICIT_ACCESS); | 735 AutofillWebDataService::ForContext(profile_); |
| 736 if (!wds.get()) | 736 if (!autofill_data.get()) |
| 737 return; | 737 return; |
| 738 | 738 |
| 739 // Any credit cards that are not in the new credit card list should be | 739 // Any credit cards that are not in the new credit card list should be |
| 740 // removed. | 740 // removed. |
| 741 for (std::vector<CreditCard*>::const_iterator iter = credit_cards_.begin(); | 741 for (std::vector<CreditCard*>::const_iterator iter = credit_cards_.begin(); |
| 742 iter != credit_cards_.end(); ++iter) { | 742 iter != credit_cards_.end(); ++iter) { |
| 743 if (!FindByGUID<CreditCard>(*credit_cards, (*iter)->guid())) | 743 if (!FindByGUID<CreditCard>(*credit_cards, (*iter)->guid())) |
| 744 wds->RemoveCreditCard((*iter)->guid()); | 744 autofill_data->RemoveCreditCard((*iter)->guid()); |
| 745 } | 745 } |
| 746 | 746 |
| 747 // Update the web database with the existing credit cards. | 747 // Update the web database with the existing credit cards. |
| 748 for (std::vector<CreditCard>::iterator iter = credit_cards->begin(); | 748 for (std::vector<CreditCard>::iterator iter = credit_cards->begin(); |
| 749 iter != credit_cards->end(); ++iter) { | 749 iter != credit_cards->end(); ++iter) { |
| 750 if (FindByGUID<CreditCard>(credit_cards_, iter->guid())) | 750 if (FindByGUID<CreditCard>(credit_cards_, iter->guid())) |
| 751 wds->UpdateCreditCard(*iter); | 751 autofill_data->UpdateCreditCard(*iter); |
| 752 } | 752 } |
| 753 | 753 |
| 754 // Add the new credit cards to the web database. Don't add a duplicate. | 754 // Add the new credit cards to the web database. Don't add a duplicate. |
| 755 for (std::vector<CreditCard>::iterator iter = credit_cards->begin(); | 755 for (std::vector<CreditCard>::iterator iter = credit_cards->begin(); |
| 756 iter != credit_cards->end(); ++iter) { | 756 iter != credit_cards->end(); ++iter) { |
| 757 if (!FindByGUID<CreditCard>(credit_cards_, iter->guid()) && | 757 if (!FindByGUID<CreditCard>(credit_cards_, iter->guid()) && |
| 758 !FindByContents(credit_cards_, *iter)) | 758 !FindByContents(credit_cards_, *iter)) |
| 759 wds->AddCreditCard(*iter); | 759 autofill_data->AddCreditCard(*iter); |
| 760 } | 760 } |
| 761 | 761 |
| 762 // Copy in the new credit cards. | 762 // Copy in the new credit cards. |
| 763 credit_cards_.clear(); | 763 credit_cards_.clear(); |
| 764 for (std::vector<CreditCard>::iterator iter = credit_cards->begin(); | 764 for (std::vector<CreditCard>::iterator iter = credit_cards->begin(); |
| 765 iter != credit_cards->end(); ++iter) { | 765 iter != credit_cards->end(); ++iter) { |
| 766 credit_cards_.push_back(new CreditCard(*iter)); | 766 credit_cards_.push_back(new CreditCard(*iter)); |
| 767 } | 767 } |
| 768 | 768 |
| 769 // Refresh our local cache and send notifications to observers. | 769 // Refresh our local cache and send notifications to observers. |
| 770 Refresh(); | 770 Refresh(); |
| 771 } | 771 } |
| 772 | 772 |
| 773 void PersonalDataManager::LoadProfiles() { | 773 void PersonalDataManager::LoadProfiles() { |
| 774 scoped_refptr<WebDataService> web_data_service = | 774 scoped_ptr<AutofillWebDataService> autofill_data = |
| 775 WebDataServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 775 AutofillWebDataService::ForContext(profile_); |
| 776 if (!web_data_service.get()) { | 776 if (!autofill_data.get()) { |
| 777 NOTREACHED(); | 777 NOTREACHED(); |
| 778 return; | 778 return; |
| 779 } | 779 } |
| 780 | 780 |
| 781 CancelPendingQuery(&pending_profiles_query_); | 781 CancelPendingQuery(&pending_profiles_query_); |
| 782 | 782 |
| 783 pending_profiles_query_ = web_data_service->GetAutofillProfiles(this); | 783 pending_profiles_query_ = autofill_data->GetAutofillProfiles(this); |
| 784 } | 784 } |
| 785 | 785 |
| 786 // Win and Linux implementations do nothing. Mac implementation fills in the | 786 // Win and Linux implementations do nothing. Mac implementation fills in the |
| 787 // contents of |auxiliary_profiles_|. | 787 // contents of |auxiliary_profiles_|. |
| 788 #if !defined(OS_MACOSX) | 788 #if !defined(OS_MACOSX) |
| 789 void PersonalDataManager::LoadAuxiliaryProfiles() const { | 789 void PersonalDataManager::LoadAuxiliaryProfiles() const { |
| 790 } | 790 } |
| 791 #endif | 791 #endif |
| 792 | 792 |
| 793 void PersonalDataManager::LoadCreditCards() { | 793 void PersonalDataManager::LoadCreditCards() { |
| 794 scoped_refptr<WebDataService> web_data_service = | 794 scoped_ptr<AutofillWebDataService> autofill_data = |
| 795 WebDataServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 795 AutofillWebDataService::ForContext(profile_); |
| 796 if (!web_data_service.get()) { | 796 if (!autofill_data.get()) { |
| 797 NOTREACHED(); | 797 NOTREACHED(); |
| 798 return; | 798 return; |
| 799 } | 799 } |
| 800 | 800 |
| 801 CancelPendingQuery(&pending_creditcards_query_); | 801 CancelPendingQuery(&pending_creditcards_query_); |
| 802 | 802 |
| 803 pending_creditcards_query_ = web_data_service->GetCreditCards(this); | 803 pending_creditcards_query_ = autofill_data->GetCreditCards(this); |
| 804 } | 804 } |
| 805 | 805 |
| 806 void PersonalDataManager::ReceiveLoadedProfiles(WebDataService::Handle h, | 806 void PersonalDataManager::ReceiveLoadedProfiles(WebDataServiceBase::Handle h, |
| 807 const WDTypedResult* result) { | 807 const WDTypedResult* result) { |
| 808 DCHECK_EQ(pending_profiles_query_, h); | 808 DCHECK_EQ(pending_profiles_query_, h); |
| 809 | 809 |
| 810 pending_profiles_query_ = 0; | 810 pending_profiles_query_ = 0; |
| 811 web_profiles_.clear(); | 811 web_profiles_.clear(); |
| 812 | 812 |
| 813 const WDResult<std::vector<AutofillProfile*> >* r = | 813 const WDResult<std::vector<AutofillProfile*> >* r = |
| 814 static_cast<const WDResult<std::vector<AutofillProfile*> >*>(result); | 814 static_cast<const WDResult<std::vector<AutofillProfile*> >*>(result); |
| 815 | 815 |
| 816 std::vector<AutofillProfile*> profiles = r->GetValue(); | 816 std::vector<AutofillProfile*> profiles = r->GetValue(); |
| 817 for (std::vector<AutofillProfile*>::iterator iter = profiles.begin(); | 817 for (std::vector<AutofillProfile*>::iterator iter = profiles.begin(); |
| 818 iter != profiles.end(); ++iter) { | 818 iter != profiles.end(); ++iter) { |
| 819 web_profiles_.push_back(*iter); | 819 web_profiles_.push_back(*iter); |
| 820 } | 820 } |
| 821 | 821 |
| 822 LogProfileCount(); | 822 LogProfileCount(); |
| 823 EmptyMigrationTrash(); | 823 EmptyMigrationTrash(); |
| 824 } | 824 } |
| 825 | 825 |
| 826 void PersonalDataManager::ReceiveLoadedCreditCards( | 826 void PersonalDataManager::ReceiveLoadedCreditCards( |
| 827 WebDataService::Handle h, const WDTypedResult* result) { | 827 WebDataServiceBase::Handle h, const WDTypedResult* result) { |
| 828 DCHECK_EQ(pending_creditcards_query_, h); | 828 DCHECK_EQ(pending_creditcards_query_, h); |
| 829 | 829 |
| 830 pending_creditcards_query_ = 0; | 830 pending_creditcards_query_ = 0; |
| 831 credit_cards_.clear(); | 831 credit_cards_.clear(); |
| 832 | 832 |
| 833 const WDResult<std::vector<CreditCard*> >* r = | 833 const WDResult<std::vector<CreditCard*> >* r = |
| 834 static_cast<const WDResult<std::vector<CreditCard*> >*>(result); | 834 static_cast<const WDResult<std::vector<CreditCard*> >*>(result); |
| 835 | 835 |
| 836 std::vector<CreditCard*> credit_cards = r->GetValue(); | 836 std::vector<CreditCard*> credit_cards = r->GetValue(); |
| 837 for (std::vector<CreditCard*>::iterator iter = credit_cards.begin(); | 837 for (std::vector<CreditCard*>::iterator iter = credit_cards.begin(); |
| 838 iter != credit_cards.end(); ++iter) { | 838 iter != credit_cards.end(); ++iter) { |
| 839 credit_cards_.push_back(*iter); | 839 credit_cards_.push_back(*iter); |
| 840 } | 840 } |
| 841 } | 841 } |
| 842 | 842 |
| 843 void PersonalDataManager::CancelPendingQuery(WebDataService::Handle* handle) { | 843 void PersonalDataManager::CancelPendingQuery( |
| 844 WebDataServiceBase::Handle* handle) { | |
| 844 if (*handle) { | 845 if (*handle) { |
| 845 scoped_refptr<WebDataService> web_data_service = | 846 scoped_ptr<AutofillWebDataService> autofill_data = |
| 846 WebDataServiceFactory::GetForProfile(profile_, | 847 AutofillWebDataService::ForContext(profile_); |
| 847 Profile::EXPLICIT_ACCESS); | 848 if (!autofill_data.get()) { |
| 848 if (!web_data_service.get()) { | |
| 849 NOTREACHED(); | 849 NOTREACHED(); |
| 850 return; | 850 return; |
| 851 } | 851 } |
| 852 web_data_service->CancelRequest(*handle); | 852 autofill_data->CancelRequest(*handle); |
| 853 } | 853 } |
| 854 *handle = 0; | 854 *handle = 0; |
| 855 } | 855 } |
| 856 | 856 |
| 857 void PersonalDataManager::SaveImportedProfile( | 857 void PersonalDataManager::SaveImportedProfile( |
| 858 const AutofillProfile& imported_profile) { | 858 const AutofillProfile& imported_profile) { |
| 859 if (profile_->IsOffTheRecord()) { | 859 if (profile_->IsOffTheRecord()) { |
| 860 // The |IsOffTheRecord| check should happen earlier in the import process, | 860 // The |IsOffTheRecord| check should happen earlier in the import process, |
| 861 // upon form submission. | 861 // upon form submission. |
| 862 NOTREACHED(); | 862 NOTREACHED(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 906 if (!merged) | 906 if (!merged) |
| 907 creditcards.push_back(imported_credit_card); | 907 creditcards.push_back(imported_credit_card); |
| 908 | 908 |
| 909 SetCreditCards(&creditcards); | 909 SetCreditCards(&creditcards); |
| 910 } | 910 } |
| 911 | 911 |
| 912 void PersonalDataManager::EmptyMigrationTrash() { | 912 void PersonalDataManager::EmptyMigrationTrash() { |
| 913 if (!profile_ || profile_->IsOffTheRecord()) | 913 if (!profile_ || profile_->IsOffTheRecord()) |
| 914 return; | 914 return; |
| 915 | 915 |
| 916 scoped_refptr<WebDataService> web_data_service = | 916 scoped_ptr<AutofillWebDataService> autofill_data = |
| 917 WebDataServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 917 AutofillWebDataService::ForContext(profile_); |
| 918 if (!web_data_service.get()) { | 918 if (!autofill_data.get()) { |
| 919 NOTREACHED(); | 919 NOTREACHED(); |
| 920 return; | 920 return; |
| 921 } | 921 } |
| 922 | 922 |
| 923 ProfileSyncService* sync_service = | 923 ProfileSyncService* sync_service = |
| 924 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); | 924 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); |
| 925 if (!sync_service) | 925 if (!sync_service) |
| 926 return; | 926 return; |
| 927 | 927 |
| 928 if (!sync_service->HasSyncSetupCompleted()) { | 928 if (!sync_service->HasSyncSetupCompleted()) { |
| 929 web_data_service->EmptyMigrationTrash(false); | 929 autofill_data->EmptyMigrationTrash(false); |
| 930 } else if (sync_service->ShouldPushChanges()) { | 930 } else if (sync_service->ShouldPushChanges()) { |
| 931 web_data_service->EmptyMigrationTrash(true); | 931 autofill_data->EmptyMigrationTrash(true); |
| 932 } else { | 932 } else { |
| 933 // Install ourself as a listener so we can empty the trash once the | 933 // Install ourself as a listener so we can empty the trash once the |
| 934 // sync service becomes available. | 934 // sync service becomes available. |
| 935 if (!sync_service->HasObserver(this)) | 935 if (!sync_service->HasObserver(this)) |
| 936 sync_service->AddObserver(this); | 936 sync_service->AddObserver(this); |
| 937 } | 937 } |
| 938 } | 938 } |
| 939 | 939 |
| 940 void PersonalDataManager::LogProfileCount() const { | 940 void PersonalDataManager::LogProfileCount() const { |
| 941 if (!has_logged_profile_count_) { | 941 if (!has_logged_profile_count_) { |
| 942 metric_logger_->LogStoredProfileCount(web_profiles_.size()); | 942 metric_logger_->LogStoredProfileCount(web_profiles_.size()); |
| 943 has_logged_profile_count_ = true; | 943 has_logged_profile_count_ = true; |
| 944 } | 944 } |
| 945 } | 945 } |
| 946 | 946 |
| 947 const AutofillMetrics* PersonalDataManager::metric_logger() const { | 947 const AutofillMetrics* PersonalDataManager::metric_logger() const { |
| 948 return metric_logger_.get(); | 948 return metric_logger_.get(); |
| 949 } | 949 } |
| 950 | 950 |
| 951 void PersonalDataManager::set_metric_logger( | 951 void PersonalDataManager::set_metric_logger( |
| 952 const AutofillMetrics* metric_logger) { | 952 const AutofillMetrics* metric_logger) { |
| 953 metric_logger_.reset(metric_logger); | 953 metric_logger_.reset(metric_logger); |
| 954 } | 954 } |
| OLD | NEW |