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/ui/autofill/autofill_dialog_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/prefs/pref_service.h" | |
| 10 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 11 #include "base/string_split.h" | 13 #include "base/string_split.h" |
| 12 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 13 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/autofill/autofill_country.h" | 16 #include "chrome/browser/autofill/autofill_country.h" |
| 15 #include "chrome/browser/autofill/autofill_manager.h" | 17 #include "chrome/browser/autofill/autofill_manager.h" |
| 16 #include "chrome/browser/autofill/autofill_type.h" | 18 #include "chrome/browser/autofill/autofill_type.h" |
| 17 #include "chrome/browser/autofill/personal_data_manager.h" | 19 #include "chrome/browser/autofill/personal_data_manager.h" |
| 18 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 20 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 21 #include "chrome/browser/autofill/risk/fingerprint.h" | |
| 22 #include "chrome/browser/autofill/risk/proto/fingerprint.pb.h" | |
| 19 #include "chrome/browser/autofill/validation.h" | 23 #include "chrome/browser/autofill/validation.h" |
| 20 #include "chrome/browser/autofill/wallet/full_wallet.h" | 24 #include "chrome/browser/autofill/wallet/full_wallet.h" |
| 21 #include "chrome/browser/autofill/wallet/wallet_items.h" | 25 #include "chrome/browser/autofill/wallet/wallet_items.h" |
| 22 #include "chrome/browser/autofill/wallet/wallet_service_url.h" | 26 #include "chrome/browser/autofill/wallet/wallet_service_url.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 28 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
| 25 #include "chrome/browser/ui/autofill/data_model_wrapper.h" | 29 #include "chrome/browser/ui/autofill/data_model_wrapper.h" |
| 30 #include "chrome/browser/ui/browser.h" | |
| 31 #include "chrome/browser/ui/browser_finder.h" | |
| 32 #include "chrome/browser/ui/browser_window.h" | |
| 26 #include "chrome/common/form_data.h" | 33 #include "chrome/common/form_data.h" |
| 27 #include "content/public/browser/navigation_controller.h" | 34 #include "content/public/browser/navigation_controller.h" |
| 28 #include "content/public/browser/navigation_details.h" | 35 #include "content/public/browser/navigation_details.h" |
| 29 #include "content/public/browser/navigation_entry.h" | 36 #include "content/public/browser/navigation_entry.h" |
| 30 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
| 31 #include "content/public/browser/notification_types.h" | 38 #include "content/public/browser/notification_types.h" |
| 32 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
| 33 #include "content/public/common/url_constants.h" | 40 #include "content/public/common/url_constants.h" |
| 34 #include "grit/chromium_strings.h" | 41 #include "grit/chromium_strings.h" |
| 35 #include "grit/generated_resources.h" | 42 #include "grit/generated_resources.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 source_url_(source_url), | 142 source_url_(source_url), |
| 136 ssl_status_(ssl_status), | 143 ssl_status_(ssl_status), |
| 137 callback_(callback), | 144 callback_(callback), |
| 138 wallet_client_(profile_->GetRequestContext()), | 145 wallet_client_(profile_->GetRequestContext()), |
| 139 refresh_wallet_items_queued_(false), | 146 refresh_wallet_items_queued_(false), |
| 140 had_wallet_error_(false), | 147 had_wallet_error_(false), |
| 141 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_email_(this)), | 148 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_email_(this)), |
| 142 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_cc_(this)), | 149 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_cc_(this)), |
| 143 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_billing_(this)), | 150 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_billing_(this)), |
| 144 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_shipping_(this)), | 151 ALLOW_THIS_IN_INITIALIZER_LIST(suggested_shipping_(this)), |
| 145 section_showing_popup_(SECTION_BILLING) { | 152 section_showing_popup_(SECTION_BILLING), |
| 153 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | |
| 146 // TODO(estade): |this| should observe PersonalDataManager. | 154 // TODO(estade): |this| should observe PersonalDataManager. |
| 147 // TODO(estade): remove duplicates from |form|? | 155 // TODO(estade): remove duplicates from |form|? |
| 148 | 156 |
| 149 content::NavigationEntry* entry = contents->GetController().GetActiveEntry(); | 157 content::NavigationEntry* entry = contents->GetController().GetActiveEntry(); |
| 150 const GURL& active_url = entry ? entry->GetURL() : web_contents()->GetURL(); | 158 const GURL& active_url = entry ? entry->GetURL() : web_contents()->GetURL(); |
| 151 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin(); | 159 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin(); |
| 152 } | 160 } |
| 153 | 161 |
| 154 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { | 162 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { |
| 155 if (popup_controller_) | 163 if (popup_controller_) |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1075 DetailInputs* AutofillDialogControllerImpl::MutableRequestedFieldsForSection( | 1083 DetailInputs* AutofillDialogControllerImpl::MutableRequestedFieldsForSection( |
| 1076 DialogSection section) { | 1084 DialogSection section) { |
| 1077 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); | 1085 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); |
| 1078 } | 1086 } |
| 1079 | 1087 |
| 1080 void AutofillDialogControllerImpl::HidePopup() { | 1088 void AutofillDialogControllerImpl::HidePopup() { |
| 1081 if (popup_controller_) | 1089 if (popup_controller_) |
| 1082 popup_controller_->Hide(); | 1090 popup_controller_->Hide(); |
| 1083 } | 1091 } |
| 1084 | 1092 |
| 1093 void AutofillDialogControllerImpl::LoadRiskFingerprintData() { | |
| 1094 // TODO(dbeam): Add a DCHECK that the ToS have been accepted prior to | |
|
Evan Stade
2013/02/19 21:18:18
due to the sensitivity of the issue, perhaps somet
Ilya Sherman
2013/02/20 00:05:19
Do you mean something like a CHECK(), or handling
| |
| 1095 // calling into this method. Also, ensure that the UI contains a clear | |
| 1096 // indication to the user as to what data will be collected. Until then, this | |
| 1097 // code should not be called. | |
| 1098 | |
| 1099 int64 gaia_id = 0; | |
| 1100 bool success = | |
| 1101 base::StringToInt64(wallet_items_->obfuscated_gaia_id(), &gaia_id); | |
| 1102 DCHECK(success); | |
| 1103 | |
| 1104 gfx::Rect window_bounds = | |
| 1105 chrome::FindBrowserWithWebContents(web_contents())->window()->GetBounds(); | |
| 1106 | |
| 1107 risk::GetFingerprint( | |
| 1108 gaia_id, window_bounds, *web_contents(), *profile_->GetPrefs(), | |
| 1109 base::Bind(&AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData, | |
| 1110 weak_ptr_factory_.GetWeakPtr())); | |
| 1111 } | |
| 1112 | |
| 1113 void AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData( | |
| 1114 scoped_ptr<risk::Fingerprint> fingerprint) { | |
| 1115 NOTIMPLEMENTED(); | |
| 1116 } | |
| 1117 | |
| 1085 } // namespace autofill | 1118 } // namespace autofill |
| OLD | NEW |