| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 callback.Run(AutofillClient::AutocompleteResultErrorDisabled, | 149 callback.Run(AutofillClient::AutocompleteResultErrorDisabled, |
| 150 base::string16(), | 150 base::string16(), |
| 151 NULL); | 151 NULL); |
| 152 NOTIMPLEMENTED(); | 152 NOTIMPLEMENTED(); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 void ChromeAutofillClient::ShowAutofillPopup( | 156 void ChromeAutofillClient::ShowAutofillPopup( |
| 157 const gfx::RectF& element_bounds, | 157 const gfx::RectF& element_bounds, |
| 158 base::i18n::TextDirection text_direction, | 158 base::i18n::TextDirection text_direction, |
| 159 const std::vector<base::string16>& values, | 159 const std::vector<autofill::Suggestion>& suggestions, |
| 160 const std::vector<base::string16>& labels, | |
| 161 const std::vector<base::string16>& icons, | |
| 162 const std::vector<int>& identifiers, | |
| 163 base::WeakPtr<AutofillPopupDelegate> delegate) { | 160 base::WeakPtr<AutofillPopupDelegate> delegate) { |
| 164 // Convert element_bounds to be in screen space. | 161 // Convert element_bounds to be in screen space. |
| 165 gfx::Rect client_area = web_contents()->GetContainerBounds(); | 162 gfx::Rect client_area = web_contents()->GetContainerBounds(); |
| 166 gfx::RectF element_bounds_in_screen_space = | 163 gfx::RectF element_bounds_in_screen_space = |
| 167 element_bounds + client_area.OffsetFromOrigin(); | 164 element_bounds + client_area.OffsetFromOrigin(); |
| 168 | 165 |
| 169 // Will delete or reuse the old |popup_controller_|. | 166 // Will delete or reuse the old |popup_controller_|. |
| 170 popup_controller_ = | 167 popup_controller_ = |
| 171 AutofillPopupControllerImpl::GetOrCreate(popup_controller_, | 168 AutofillPopupControllerImpl::GetOrCreate(popup_controller_, |
| 172 delegate, | 169 delegate, |
| 173 web_contents(), | 170 web_contents(), |
| 174 web_contents()->GetNativeView(), | 171 web_contents()->GetNativeView(), |
| 175 element_bounds_in_screen_space, | 172 element_bounds_in_screen_space, |
| 176 text_direction); | 173 text_direction); |
| 177 | 174 |
| 178 popup_controller_->Show(values, labels, icons, identifiers); | 175 popup_controller_->Show(suggestions); |
| 179 } | 176 } |
| 180 | 177 |
| 181 void ChromeAutofillClient::UpdateAutofillPopupDataListValues( | 178 void ChromeAutofillClient::UpdateAutofillPopupDataListValues( |
| 182 const std::vector<base::string16>& values, | 179 const std::vector<base::string16>& values, |
| 183 const std::vector<base::string16>& labels) { | 180 const std::vector<base::string16>& labels) { |
| 184 if (popup_controller_.get()) | 181 if (popup_controller_.get()) |
| 185 popup_controller_->UpdateDataListValues(values, labels); | 182 popup_controller_->UpdateDataListValues(values, labels); |
| 186 } | 183 } |
| 187 | 184 |
| 188 void ChromeAutofillClient::HideAutofillPopup() { | 185 void ChromeAutofillClient::HideAutofillPopup() { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 profile_full_name); | 231 profile_full_name); |
| 235 #endif // defined(OS_ANDROID) | 232 #endif // defined(OS_ANDROID) |
| 236 } | 233 } |
| 237 | 234 |
| 238 void ChromeAutofillClient::OnFirstUserGestureObserved() { | 235 void ChromeAutofillClient::OnFirstUserGestureObserved() { |
| 239 web_contents()->SendToAllFrames( | 236 web_contents()->SendToAllFrames( |
| 240 new AutofillMsg_FirstUserGestureObservedInTab(routing_id())); | 237 new AutofillMsg_FirstUserGestureObservedInTab(routing_id())); |
| 241 } | 238 } |
| 242 | 239 |
| 243 } // namespace autofill | 240 } // namespace autofill |
| OLD | NEW |