| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/autofill/autofill_dialog_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 case wallet::WalletItems::MaskedInstrument::VALID: | 298 case wallet::WalletItems::MaskedInstrument::VALID: |
| 299 case wallet::WalletItems::MaskedInstrument::PENDING: | 299 case wallet::WalletItems::MaskedInstrument::PENDING: |
| 300 case wallet::WalletItems::MaskedInstrument::EXPIRED: | 300 case wallet::WalletItems::MaskedInstrument::EXPIRED: |
| 301 case wallet::WalletItems::MaskedInstrument::BILLING_INCOMPLETE: | 301 case wallet::WalletItems::MaskedInstrument::BILLING_INCOMPLETE: |
| 302 return true; | 302 return true; |
| 303 default: | 303 default: |
| 304 return false; | 304 return false; |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 // Signals that the user has opted in to geolocation services. Factored out | |
| 309 // into a separate method because all interaction with the geolocation provider | |
| 310 // needs to happen on the IO thread, which is not the thread | |
| 311 // AutofillDialogViewDelegate lives on. | |
| 312 void UserDidOptIntoLocationServices() { | |
| 313 content::GeolocationProvider::GetInstance()->UserDidOptIntoLocationServices(); | |
| 314 } | |
| 315 | |
| 316 // Loops through |addresses_| comparing to |address| ignoring ID. If a match | 308 // Loops through |addresses_| comparing to |address| ignoring ID. If a match |
| 317 // is not found, NULL is returned. | 309 // is not found, NULL is returned. |
| 318 const wallet::Address* FindDuplicateAddress( | 310 const wallet::Address* FindDuplicateAddress( |
| 319 const std::vector<wallet::Address*>& addresses, | 311 const std::vector<wallet::Address*>& addresses, |
| 320 const wallet::Address& address) { | 312 const wallet::Address& address) { |
| 321 for (size_t i = 0; i < addresses.size(); ++i) { | 313 for (size_t i = 0; i < addresses.size(); ++i) { |
| 322 if (addresses[i]->EqualsIgnoreID(address)) | 314 if (addresses[i]->EqualsIgnoreID(address)) |
| 323 return addresses[i]; | 315 return addresses[i]; |
| 324 } | 316 } |
| 325 return NULL; | 317 return NULL; |
| (...skipping 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3618 view_->UpdateNotificationArea(); | 3610 view_->UpdateNotificationArea(); |
| 3619 } | 3611 } |
| 3620 } | 3612 } |
| 3621 | 3613 |
| 3622 bool AutofillDialogControllerImpl::AreLegalDocumentsCurrent() const { | 3614 bool AutofillDialogControllerImpl::AreLegalDocumentsCurrent() const { |
| 3623 return has_accepted_legal_documents_ || | 3615 return has_accepted_legal_documents_ || |
| 3624 (wallet_items_ && wallet_items_->legal_documents().empty()); | 3616 (wallet_items_ && wallet_items_->legal_documents().empty()); |
| 3625 } | 3617 } |
| 3626 | 3618 |
| 3627 void AutofillDialogControllerImpl::AcceptLegalTerms() { | 3619 void AutofillDialogControllerImpl::AcceptLegalTerms() { |
| 3628 content::BrowserThread::PostTask( | 3620 content::GeolocationProvider::GetInstance()->UserDidOptIntoLocationServices(); |
| 3629 content::BrowserThread::IO, FROM_HERE, | |
| 3630 base::Bind(&UserDidOptIntoLocationServices)); | |
| 3631 PrefService* local_state = g_browser_process->local_state(); | 3621 PrefService* local_state = g_browser_process->local_state(); |
| 3632 ListPrefUpdate accepted( | 3622 ListPrefUpdate accepted( |
| 3633 local_state, ::prefs::kAutofillDialogWalletLocationAcceptance); | 3623 local_state, ::prefs::kAutofillDialogWalletLocationAcceptance); |
| 3634 accepted->AppendIfNotPresent(new base::StringValue( | 3624 accepted->AppendIfNotPresent(new base::StringValue( |
| 3635 account_chooser_model_->GetActiveWalletAccountName())); | 3625 account_chooser_model_->GetActiveWalletAccountName())); |
| 3636 | 3626 |
| 3637 if (AreLegalDocumentsCurrent()) { | 3627 if (AreLegalDocumentsCurrent()) { |
| 3638 LoadRiskFingerprintData(); | 3628 LoadRiskFingerprintData(); |
| 3639 } else { | 3629 } else { |
| 3640 GetWalletClient()->AcceptLegalDocuments( | 3630 GetWalletClient()->AcceptLegalDocuments( |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4081 view_->UpdateButtonStrip(); | 4071 view_->UpdateButtonStrip(); |
| 4082 } | 4072 } |
| 4083 | 4073 |
| 4084 void AutofillDialogControllerImpl::FetchWalletCookie() { | 4074 void AutofillDialogControllerImpl::FetchWalletCookie() { |
| 4085 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 4075 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
| 4086 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 4076 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
| 4087 signin_helper_->StartWalletCookieValueFetch(); | 4077 signin_helper_->StartWalletCookieValueFetch(); |
| 4088 } | 4078 } |
| 4089 | 4079 |
| 4090 } // namespace autofill | 4080 } // namespace autofill |
| OLD | NEW |