Chromium Code Reviews| Index: components/autofill/content/browser/content_autofill_driver.cc |
| diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc |
| index c031fe4a6c27ffe6cd117112557cfd885370169d..aa2ac71fad0bdb047effda083b687c6785c9cb12 100644 |
| --- a/components/autofill/content/browser/content_autofill_driver.cc |
| +++ b/components/autofill/content/browser/content_autofill_driver.cc |
| @@ -7,6 +7,7 @@ |
| #include <utility> |
| #include "base/command_line.h" |
| +#include "base/strings/utf_string_conversions.h" |
| #include "base/threading/sequenced_worker_pool.h" |
| #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| #include "components/autofill/content/common/autofill_messages.h" |
| @@ -25,7 +26,6 @@ |
| #include "content/public/browser/site_instance.h" |
| #include "content/public/browser/storage_partition.h" |
| #include "content/public/browser/web_contents.h" |
| -#include "mojo/common/common_type_converters.h" |
| #include "services/shell/public/cpp/interface_provider.h" |
| #include "ui/gfx/geometry/size_f.h" |
| @@ -116,15 +116,14 @@ void ContentAutofillDriver::SendAutofillTypePredictionsToRenderer( |
| std::vector<FormDataPredictions> type_predictions = |
| FormStructure::GetFieldTypePredictions(forms); |
| - GetAutofillAgent()->FieldTypePredictionsAvailable( |
| - std::move(type_predictions)); |
| + GetAutofillAgent()->FieldTypePredictionsAvailable(type_predictions); |
| } |
| void ContentAutofillDriver::RendererShouldAcceptDataListSuggestion( |
| const base::string16& value) { |
| if (!RendererIsAvailable()) |
| return; |
| - GetAutofillAgent()->AcceptDataListSuggestion(mojo::String::From(value)); |
| + GetAutofillAgent()->AcceptDataListSuggestion(base::UTF16ToUTF8(value)); |
| } |
| void ContentAutofillDriver::RendererShouldClearFilledForm() { |
| @@ -143,14 +142,14 @@ void ContentAutofillDriver::RendererShouldFillFieldWithValue( |
| const base::string16& value) { |
| if (!RendererIsAvailable()) |
| return; |
| - GetAutofillAgent()->FillFieldWithValue(mojo::String::From(value)); |
| + GetAutofillAgent()->FillFieldWithValue(base::UTF16ToUTF8(value)); |
| } |
| void ContentAutofillDriver::RendererShouldPreviewFieldWithValue( |
| const base::string16& value) { |
| if (!RendererIsAvailable()) |
| return; |
| - GetAutofillAgent()->PreviewFieldWithValue(mojo::String::From(value)); |
| + GetAutofillAgent()->PreviewFieldWithValue(base::UTF16ToUTF8(value)); |
| } |
| void ContentAutofillDriver::PopupHidden() { |
| @@ -178,9 +177,9 @@ void ContentAutofillDriver::FirstUserGestureObserved() { |
| client_->OnFirstUserGestureObserved(); |
| } |
| -void ContentAutofillDriver::FormsSeen(mojo::Array<FormData> forms, |
| +void ContentAutofillDriver::FormsSeen(const std::vector<FormData>& forms, |
| base::TimeTicks timestamp) { |
| - autofill_manager_->OnFormsSeen(forms.storage(), timestamp); |
| + autofill_manager_->OnFormsSeen(forms, timestamp); |
| } |
| void ContentAutofillDriver::WillSubmitForm(const FormData& form, |
| @@ -231,10 +230,16 @@ void ContentAutofillDriver::DidEndTextFieldEditing() { |
| autofill_manager_->OnDidEndTextFieldEditing(); |
| } |
| -void ContentAutofillDriver::SetDataList(mojo::Array<mojo::String> values, |
| - mojo::Array<mojo::String> labels) { |
| - autofill_manager_->OnSetDataList(values.To<std::vector<base::string16>>(), |
| - labels.To<std::vector<base::string16>>()); |
| +void ContentAutofillDriver::SetDataList( |
| + const std::vector<std::string>& values, |
| + const std::vector<std::string>& labels) { |
| + std::vector<base::string16> values16; |
|
yzshen1
2016/07/26 16:45:36
nit: please reserve the same size as |values| to a
leonhsl(Using Gerrit)
2016/07/27 02:50:26
Yeah, I have the same feeling.. Seems lots of inte
yzshen1
2016/07/27 06:21:20
SGTM Thanks!
leonhsl(Using Gerrit)
2016/07/27 09:25:32
Done. Use base::string16 typemap now, removed thes
|
| + for (const auto& i : values) |
| + values16.emplace_back(base::UTF8ToUTF16(i)); |
| + std::vector<base::string16> labels16; |
|
yzshen1
2016/07/26 16:45:36
ditto
leonhsl(Using Gerrit)
2016/07/27 02:50:26
Acknowledged.
leonhsl(Using Gerrit)
2016/07/27 09:25:32
Done. Use base::string16 typemap now, removed thes
|
| + for (const auto& i : labels) |
| + labels16.emplace_back(base::UTF8ToUTF16(i)); |
| + autofill_manager_->OnSetDataList(values16, labels16); |
| } |
| void ContentAutofillDriver::DidNavigateFrame( |