diff options
author | keishi@chromium.org <keishi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-17 10:47:49 +0000 |
---|---|---|
committer | keishi@chromium.org <keishi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-17 10:47:49 +0000 |
commit | bef7f9277bdef5480ef2d607e58105426f1be825 (patch) | |
tree | 37b89cce3ec4a7c77543c7af25841665dbd32772 /chrome/browser | |
parent | c27e71f9dc31e4826529b9ca3ddf99b762b66e15 (diff) | |
download | chromium_src-bef7f9277bdef5480ef2d607e58105426f1be825.zip chromium_src-bef7f9277bdef5480ef2d607e58105426f1be825.tar.gz chromium_src-bef7f9277bdef5480ef2d607e58105426f1be825.tar.bz2 |
DataList UI (Chromium part)
WebKit part is here
http://codereview.chromium.org/10037002/
Example page for <datalist>
https://tinker.io/22681/191
BUG=
TEST=
Review URL: http://codereview.chromium.org/10024059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/autofill/autofill_external_delegate.cc | 21 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_manager.cc | 4 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_manager_unittest.cc | 4 |
3 files changed, 13 insertions, 16 deletions
diff --git a/chrome/browser/autofill/autofill_external_delegate.cc b/chrome/browser/autofill/autofill_external_delegate.cc index ff94bd4..08ce18a 100644 --- a/chrome/browser/autofill/autofill_external_delegate.cc +++ b/chrome/browser/autofill/autofill_external_delegate.cc @@ -12,19 +12,11 @@ #include "content/public/browser/web_contents.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" #include "ui/base/l10n/l10n_util.h" using content::RenderViewHost; - -namespace { - -// The value to give as the unique id for all warnings. -const int kWarningId = -1; - -// The value to give as the unique id for all password entries. -const int kPasswordEntryId = -2; - -} // namespace +using WebKit::WebAutofillClient; AutofillExternalDelegate::~AutofillExternalDelegate() { } @@ -51,7 +43,7 @@ void AutofillExternalDelegate::SelectAutofillSuggestionAtIndex(int unique_id, if (list_index == suggestions_options_index_ || list_index == suggestions_clear_index_ || - unique_id == kWarningId) + unique_id == WebAutofillClient::MenuItemIDWarningMessage) return; FillAutofillFormData(unique_id, true); @@ -97,7 +89,7 @@ void AutofillExternalDelegate::OnSuggestionsReturned( v.assign(1, l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED)); l.assign(1, string16()); i.assign(1, string16()); - ids.assign(1, kWarningId); + ids.assign(1, WebAutofillClient::MenuItemIDWarningMessage); } else if (ids[0] < 0 && ids.size() > 1) { // If we received a warning instead of suggestions from autofill but regular // suggestions from autocomplete, don't show the autofill warning. @@ -166,7 +158,8 @@ void AutofillExternalDelegate::OnShowPasswordSuggestions( SetBounds(bounds); std::vector<string16> empty(suggestions.size()); - std::vector<int> password_ids(suggestions.size(), kPasswordEntryId); + std::vector<int> password_ids(suggestions.size(), + WebAutofillClient::MenuItemIDPasswordEntry); ApplyAutofillSuggestions(suggestions, empty, empty, password_ids, -1); } @@ -179,7 +172,7 @@ bool AutofillExternalDelegate::DidAcceptAutofillSuggestions( int unique_id, unsigned index) { // If the selected element is a warning we don't want to do anything. - if (unique_id == kWarningId) + if (unique_id == WebAutofillClient::MenuItemIDWarningMessage) return false; if (suggestions_options_index_ != -1 && diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index 9a16f3f..0136f79 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -62,6 +62,7 @@ #include "webkit/forms/form_data_predictions.h" #include "webkit/forms/form_field.h" #include "webkit/forms/password_form_dom_manager.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" using base::TimeTicks; using content::BrowserThread; @@ -480,7 +481,8 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id, values.assign(1, l10n_util::GetStringUTF16(warning)); labels.assign(1, string16()); icons.assign(1, string16()); - unique_ids.assign(1, -1); + unique_ids.assign(1, + WebKit::WebAutofillClient::MenuItemIDWarningMessage); } else { bool section_is_autofilled = SectionIsAutofilled(*form_structure, form, diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index 0d4cebb..f265402 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -43,6 +43,7 @@ #include "ui/gfx/rect.h" #include "webkit/forms/form_data.h" #include "webkit/forms/form_field.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" using content::BrowserThread; using content::WebContents; @@ -911,7 +912,8 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsMethodGet) { }; string16 expected_labels[] = {string16()}; string16 expected_icons[] = {string16()}; - int expected_unique_ids[] = {-1}; + int expected_unique_ids[] = + {WebKit::WebAutofillClient::MenuItemIDWarningMessage}; ExpectSuggestions(page_id, values, labels, icons, unique_ids, kDefaultPageID, arraysize(expected_values), expected_values, expected_labels, expected_icons, expected_unique_ids); |