| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_autofill_client.h" | 5 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 9 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
| 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 void ChromeAutofillClient::ShowAutofillPopup( | 134 void ChromeAutofillClient::ShowAutofillPopup( |
| 135 const gfx::RectF& element_bounds, | 135 const gfx::RectF& element_bounds, |
| 136 base::i18n::TextDirection text_direction, | 136 base::i18n::TextDirection text_direction, |
| 137 const std::vector<base::string16>& values, | 137 const std::vector<base::string16>& values, |
| 138 const std::vector<base::string16>& labels, | 138 const std::vector<base::string16>& labels, |
| 139 const std::vector<base::string16>& icons, | 139 const std::vector<base::string16>& icons, |
| 140 const std::vector<int>& identifiers, | 140 const std::vector<int>& identifiers, |
| 141 const base::string16& title, |
| 141 base::WeakPtr<AutofillPopupDelegate> delegate) { | 142 base::WeakPtr<AutofillPopupDelegate> delegate) { |
| 142 // Convert element_bounds to be in screen space. | 143 // Convert element_bounds to be in screen space. |
| 143 gfx::Rect client_area = web_contents_->GetContainerBounds(); | 144 gfx::Rect client_area = web_contents_->GetContainerBounds(); |
| 144 gfx::RectF element_bounds_in_screen_space = | 145 gfx::RectF element_bounds_in_screen_space = |
| 145 element_bounds + client_area.OffsetFromOrigin(); | 146 element_bounds + client_area.OffsetFromOrigin(); |
| 146 | 147 |
| 147 // Will delete or reuse the old |popup_controller_|. | 148 // Will delete or reuse the old |popup_controller_|. |
| 148 popup_controller_ = | 149 popup_controller_ = |
| 149 AutofillPopupControllerImpl::GetOrCreate(popup_controller_, | 150 AutofillPopupControllerImpl::GetOrCreate(popup_controller_, |
| 150 delegate, | 151 delegate, |
| 151 web_contents(), | 152 web_contents(), |
| 152 web_contents()->GetNativeView(), | 153 web_contents()->GetNativeView(), |
| 153 element_bounds_in_screen_space, | 154 element_bounds_in_screen_space, |
| 154 text_direction); | 155 text_direction); |
| 155 | 156 |
| 156 popup_controller_->Show(values, labels, icons, identifiers); | 157 popup_controller_->Show(values, labels, icons, identifiers, title); |
| 157 } | 158 } |
| 158 | 159 |
| 159 void ChromeAutofillClient::UpdateAutofillPopupDataListValues( | 160 void ChromeAutofillClient::UpdateAutofillPopupDataListValues( |
| 160 const std::vector<base::string16>& values, | 161 const std::vector<base::string16>& values, |
| 161 const std::vector<base::string16>& labels) { | 162 const std::vector<base::string16>& labels) { |
| 162 if (popup_controller_.get()) | 163 if (popup_controller_.get()) |
| 163 popup_controller_->UpdateDataListValues(values, labels); | 164 popup_controller_->UpdateDataListValues(values, labels); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void ChromeAutofillClient::HideAutofillPopup() { | 167 void ChromeAutofillClient::HideAutofillPopup() { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 void ChromeAutofillClient::DidFillOrPreviewField( | 207 void ChromeAutofillClient::DidFillOrPreviewField( |
| 207 const base::string16& autofilled_value, | 208 const base::string16& autofilled_value, |
| 208 const base::string16& profile_full_name) { | 209 const base::string16& profile_full_name) { |
| 209 #if defined(OS_ANDROID) | 210 #if defined(OS_ANDROID) |
| 210 AutofillLoggerAndroid::DidFillOrPreviewField(autofilled_value, | 211 AutofillLoggerAndroid::DidFillOrPreviewField(autofilled_value, |
| 211 profile_full_name); | 212 profile_full_name); |
| 212 #endif // defined(OS_ANDROID) | 213 #endif // defined(OS_ANDROID) |
| 213 } | 214 } |
| 214 | 215 |
| 215 } // namespace autofill | 216 } // namespace autofill |
| OLD | NEW |