summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-20 18:55:36 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-20 18:55:36 +0000
commit9150291ada22937b7df835dd0e4c12f2d198c370 (patch)
treeeb63cc2062f35be90401778e93cbc8b18a8a236f /chrome
parent2d6b6e0fcb403ca0139756a99faf0b7036a2d758 (diff)
downloadchromium_src-9150291ada22937b7df835dd0e4c12f2d198c370.zip
chromium_src-9150291ada22937b7df835dd0e4c12f2d198c370.tar.gz
chromium_src-9150291ada22937b7df835dd0e4c12f2d198c370.tar.bz2
Autofill profile pop-up should trigger for mouse double-clicks
Removes the cancellation logic for separated AutoFill and Autocomplete. This is no longer needed. The recent refactoring of the popup handling causes this logic to always hit the "cancel" scenario and thus return only Autocomplete suggestions and never AutoFill suggestions. But in fact, we get the Autocomplete-only results in the correct cases by virtue of the field type queried. BUG=54875 TEST=AutoFillManagerTest.GetFieldSuggestions* Review URL: http://codereview.chromium.org/3405015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59950 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/autofill/autofill_manager_unittest.cc21
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc14
-rw-r--r--chrome/browser/renderer_host/render_view_host.h1
3 files changed, 13 insertions, 23 deletions
diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc
index 7d78a9b..c84d482 100644
--- a/chrome/browser/autofill/autofill_manager_unittest.cc
+++ b/chrome/browser/autofill/autofill_manager_unittest.cc
@@ -662,28 +662,33 @@ TEST_F(AutoFillManagerTest, GetFieldSuggestionsForAutocompleteOnly) {
// The page ID sent to the AutoFillManager from the RenderView, used to send
// an IPC message back to the renderer.
const int kPageID = 1;
- const int kAlternatePageID = 0;
webkit_glue::FormField field;
autofill_unittest::CreateTestFormField(
- "First Name", "firstname", "", "text", &field);
- EXPECT_TRUE(autofill_manager_->GetAutoFillSuggestions(kPageID, true, field));
+ "Some Field", "somefield", "", "text", &field);
+ EXPECT_FALSE(autofill_manager_->GetAutoFillSuggestions(kPageID, true, field));
// No suggestions provided, so send an empty vector as the results.
// This triggers the combined message send.
// In this case, we're simulating a cancel of Autocomplete with a different
// page ID and an empty vector of suggestions.
- rvh()->AutocompleteSuggestionsReturned(kAlternatePageID,
- std::vector<string16>());
+ std::vector<string16> suggestions;
+ suggestions.push_back(ASCIIToUTF16("one"));
+ suggestions.push_back(ASCIIToUTF16("two"));
+ rvh()->AutocompleteSuggestionsReturned(kPageID, suggestions);
// Test that we sent the right message to the renderer.
int page_id = 0;
std::vector<string16> values;
std::vector<string16> labels;
EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels));
- EXPECT_EQ(kAlternatePageID, page_id);
- ASSERT_EQ(0U, values.size());
- ASSERT_EQ(0U, labels.size());
+ EXPECT_EQ(kPageID, page_id);
+ ASSERT_EQ(2U, values.size());
+ ASSERT_EQ(2U, labels.size());
+ EXPECT_EQ(ASCIIToUTF16("one"), values[0]);
+ EXPECT_EQ(string16(), labels[0]);
+ EXPECT_EQ(ASCIIToUTF16("two"), values[1]);
+ EXPECT_EQ(string16(), labels[1]);
}
TEST_F(AutoFillManagerTest, GetFieldSuggestionsWithDuplicateValues) {
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index b973cd4..1cad374 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -132,7 +132,6 @@ RenderViewHost::RenderViewHost(SiteInstance* instance,
sudden_termination_allowed_(false),
session_storage_namespace_(session_storage),
is_extension_process_(false),
- autofill_query_id_(0),
save_accessibility_tree_for_testing_(false) {
if (!session_storage_namespace_) {
session_storage_namespace_ =
@@ -1726,7 +1725,6 @@ void RenderViewHost::AutoFillSuggestionsReturned(
const std::vector<string16>& labels,
const std::vector<string16>& icons,
const std::vector<int>& unique_ids) {
- autofill_query_id_ = query_id;
autofill_values_.assign(names.begin(), names.end());
autofill_labels_.assign(labels.begin(), labels.end());
autofill_icons_.assign(icons.begin(), icons.end());
@@ -1735,18 +1733,6 @@ void RenderViewHost::AutoFillSuggestionsReturned(
void RenderViewHost::AutocompleteSuggestionsReturned(
int query_id, const std::vector<string16>& suggestions) {
- // When query IDs match we are responding to an AutoFill and Autocomplete
- // combined query response.
- // Otherwise Autocomplete is canceling, so we only send suggestions (usually
- // an empty list).
- if (autofill_query_id_ != query_id) {
- // Autocomplete is canceling.
- autofill_values_.clear();
- autofill_labels_.clear();
- autofill_icons_.clear();
- autofill_unique_ids_.clear();
- }
-
// Combine AutoFill and Autocomplete values into values and labels.
for (size_t i = 0; i < suggestions.size(); ++i) {
bool unique = true;
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 47d337a..6d3d156 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -755,7 +755,6 @@ class RenderViewHost : public RenderWidgetHost {
// AutoFill and Autocomplete suggestions. We accumulate these separately and
// send them back to the renderer together.
- int autofill_query_id_;
std::vector<string16> autofill_values_;
std::vector<string16> autofill_labels_;
std::vector<string16> autofill_icons_;