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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/i18n/case_conversion.h" | 13 #include "base/i18n/case_conversion.h" |
14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 15 #include "base/location.h" |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #include "base/prefs/pref_registry_simple.h" | 17 #include "base/prefs/pref_registry_simple.h" |
17 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
18 #include "base/prefs/scoped_user_pref_update.h" | 19 #include "base/prefs/scoped_user_pref_update.h" |
19 #include "base/rand_util.h" | 20 #include "base/rand_util.h" |
| 21 #include "base/single_thread_task_runner.h" |
20 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
22 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/thread_task_runner_handle.h" |
23 #include "base/time/time.h" | 26 #include "base/time/time.h" |
24 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 27 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
25 #include "chrome/browser/autofill/risk_util.h" | 28 #include "chrome/browser/autofill/risk_util.h" |
26 #include "chrome/browser/autofill/validation_rules_storage_factory.h" | 29 #include "chrome/browser/autofill/validation_rules_storage_factory.h" |
27 #include "chrome/browser/browser_process.h" | 30 #include "chrome/browser/browser_process.h" |
28 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
29 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" | 32 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" |
30 #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h" | 33 #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h" |
31 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 34 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
32 #include "chrome/browser/ui/autofill/data_model_wrapper.h" | 35 #include "chrome/browser/ui/autofill/data_model_wrapper.h" |
(...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2475 DCHECK_EQ(type, content::NOTIFICATION_NAV_ENTRY_COMMITTED); | 2478 DCHECK_EQ(type, content::NOTIFICATION_NAV_ENTRY_COMMITTED); |
2476 content::LoadCommittedDetails* load_details = | 2479 content::LoadCommittedDetails* load_details = |
2477 content::Details<content::LoadCommittedDetails>(details).ptr(); | 2480 content::Details<content::LoadCommittedDetails>(details).ptr(); |
2478 size_t user_index = 0; | 2481 size_t user_index = 0; |
2479 if (IsSignInContinueUrl(load_details->entry->GetVirtualURL(), &user_index)) { | 2482 if (IsSignInContinueUrl(load_details->entry->GetVirtualURL(), &user_index)) { |
2480 GetWalletClient()->SetUserIndex(user_index); | 2483 GetWalletClient()->SetUserIndex(user_index); |
2481 FetchWalletCookie(); | 2484 FetchWalletCookie(); |
2482 | 2485 |
2483 // NOTE: |HideSignIn()| may delete the WebContents which doesn't expect to | 2486 // NOTE: |HideSignIn()| may delete the WebContents which doesn't expect to |
2484 // be deleted while committing a nav entry. Just call |HideSignIn()| later. | 2487 // be deleted while committing a nav entry. Just call |HideSignIn()| later. |
2485 base::MessageLoop::current()->PostTask(FROM_HERE, | 2488 base::ThreadTaskRunnerHandle::Get()->PostTask( |
2486 base::Bind(&AutofillDialogControllerImpl::HideSignIn, | 2489 FROM_HERE, base::Bind(&AutofillDialogControllerImpl::HideSignIn, |
2487 base::Unretained(this))); | 2490 base::Unretained(this))); |
2488 } | 2491 } |
2489 } | 2492 } |
2490 | 2493 |
2491 //////////////////////////////////////////////////////////////////////////////// | 2494 //////////////////////////////////////////////////////////////////////////////// |
2492 // SuggestionsMenuModelDelegate implementation. | 2495 // SuggestionsMenuModelDelegate implementation. |
2493 | 2496 |
2494 void AutofillDialogControllerImpl::SuggestionItemSelected( | 2497 void AutofillDialogControllerImpl::SuggestionItemSelected( |
2495 SuggestionsMenuModel* model, | 2498 SuggestionsMenuModel* model, |
2496 size_t index) { | 2499 size_t index) { |
2497 ScopedViewUpdates updates(view_.get()); | 2500 ScopedViewUpdates updates(view_.get()); |
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4113 view_->UpdateButtonStrip(); | 4116 view_->UpdateButtonStrip(); |
4114 } | 4117 } |
4115 | 4118 |
4116 void AutofillDialogControllerImpl::FetchWalletCookie() { | 4119 void AutofillDialogControllerImpl::FetchWalletCookie() { |
4117 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 4120 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
4118 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 4121 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
4119 signin_helper_->StartWalletCookieValueFetch(); | 4122 signin_helper_->StartWalletCookieValueFetch(); |
4120 } | 4123 } |
4121 | 4124 |
4122 } // namespace autofill | 4125 } // namespace autofill |
OLD | NEW |