Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: chrome/browser/ui/autofill/chrome_autofill_client.cc

Issue 772253003: Create an autofill Suggestion class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self review 2 Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 callback.Run(AutofillClient::AutocompleteResultErrorDisabled, 136 callback.Run(AutofillClient::AutocompleteResultErrorDisabled,
137 base::string16(), 137 base::string16(),
138 NULL); 138 NULL);
139 NOTIMPLEMENTED(); 139 NOTIMPLEMENTED();
140 } 140 }
141 } 141 }
142 142
143 void ChromeAutofillClient::ShowAutofillPopup( 143 void ChromeAutofillClient::ShowAutofillPopup(
144 const gfx::RectF& element_bounds, 144 const gfx::RectF& element_bounds,
145 base::i18n::TextDirection text_direction, 145 base::i18n::TextDirection text_direction,
146 const std::vector<base::string16>& values, 146 const std::vector<autofill::Suggestion>& suggestions,
147 const std::vector<base::string16>& labels,
148 const std::vector<base::string16>& icons,
149 const std::vector<int>& identifiers,
150 base::WeakPtr<AutofillPopupDelegate> delegate) { 147 base::WeakPtr<AutofillPopupDelegate> delegate) {
151 // Convert element_bounds to be in screen space. 148 // Convert element_bounds to be in screen space.
152 gfx::Rect client_area = web_contents_->GetContainerBounds(); 149 gfx::Rect client_area = web_contents_->GetContainerBounds();
153 gfx::RectF element_bounds_in_screen_space = 150 gfx::RectF element_bounds_in_screen_space =
154 element_bounds + client_area.OffsetFromOrigin(); 151 element_bounds + client_area.OffsetFromOrigin();
155 152
156 // Will delete or reuse the old |popup_controller_|. 153 // Will delete or reuse the old |popup_controller_|.
157 popup_controller_ = 154 popup_controller_ =
158 AutofillPopupControllerImpl::GetOrCreate(popup_controller_, 155 AutofillPopupControllerImpl::GetOrCreate(popup_controller_,
159 delegate, 156 delegate,
160 web_contents(), 157 web_contents(),
161 web_contents()->GetNativeView(), 158 web_contents()->GetNativeView(),
162 element_bounds_in_screen_space, 159 element_bounds_in_screen_space,
163 text_direction); 160 text_direction);
164 161
165 popup_controller_->Show(values, labels, icons, identifiers); 162 popup_controller_->Show(suggestions);
166 } 163 }
167 164
168 void ChromeAutofillClient::UpdateAutofillPopupDataListValues( 165 void ChromeAutofillClient::UpdateAutofillPopupDataListValues(
169 const std::vector<base::string16>& values, 166 const std::vector<base::string16>& values,
170 const std::vector<base::string16>& labels) { 167 const std::vector<base::string16>& labels) {
171 if (popup_controller_.get()) 168 if (popup_controller_.get())
172 popup_controller_->UpdateDataListValues(values, labels); 169 popup_controller_->UpdateDataListValues(values, labels);
173 } 170 }
174 171
175 void ChromeAutofillClient::HideAutofillPopup() { 172 void ChromeAutofillClient::HideAutofillPopup() {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 profile_full_name); 218 profile_full_name);
222 #endif // defined(OS_ANDROID) 219 #endif // defined(OS_ANDROID)
223 } 220 }
224 221
225 void ChromeAutofillClient::OnFirstUserGestureObserved() { 222 void ChromeAutofillClient::OnFirstUserGestureObserved() {
226 web_contents()->SendToAllFrames( 223 web_contents()->SendToAllFrames(
227 new AutofillMsg_FirstUserGestureObservedInTab(routing_id())); 224 new AutofillMsg_FirstUserGestureObservedInTab(routing_id()));
228 } 225 }
229 226
230 } // namespace autofill 227 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698