| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/renderer_host/render_view_host.h" | 5 #include "chrome/browser/renderer_host/render_view_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1652 autofill_query_id_ = query_id; | 1652 autofill_query_id_ = query_id; |
| 1653 autofill_values_.clear(); | 1653 autofill_values_.clear(); |
| 1654 autofill_values_.insert(autofill_values_.begin(), names.begin(), names.end()); | 1654 autofill_values_.insert(autofill_values_.begin(), names.begin(), names.end()); |
| 1655 autofill_labels_.clear(); | 1655 autofill_labels_.clear(); |
| 1656 autofill_labels_.insert( | 1656 autofill_labels_.insert( |
| 1657 autofill_labels_.begin(), labels.begin(), labels.end()); | 1657 autofill_labels_.begin(), labels.begin(), labels.end()); |
| 1658 } | 1658 } |
| 1659 | 1659 |
| 1660 void RenderViewHost::AutocompleteSuggestionsReturned( | 1660 void RenderViewHost::AutocompleteSuggestionsReturned( |
| 1661 int query_id, const std::vector<string16>& suggestions) { | 1661 int query_id, const std::vector<string16>& suggestions) { |
| 1662 DCHECK_EQ(autofill_query_id_, query_id); | 1662 // When query ids match we are responding to an AutoFill and Autocomplete |
| 1663 // combined query response. |
| 1664 // Otherwise Autocomplete is cancelling, so we only send suggestions (usually |
| 1665 // an empty list). |
| 1666 if (autofill_query_id_ != query_id) { |
| 1667 // Autocomplete is cancelling. |
| 1668 autofill_values_.clear(); |
| 1669 autofill_labels_.clear(); |
| 1670 } |
| 1663 | 1671 |
| 1664 // Combine AutoFill and Autocomplete values into values and labels. | 1672 // Combine AutoFill and Autocomplete values into values and labels. |
| 1665 for (size_t i = 0; i < suggestions.size(); ++i) { | 1673 for (size_t i = 0; i < suggestions.size(); ++i) { |
| 1666 autofill_values_.push_back(suggestions[i]); | 1674 autofill_values_.push_back(suggestions[i]); |
| 1667 autofill_labels_.push_back(string16()); | 1675 autofill_labels_.push_back(string16()); |
| 1668 } | 1676 } |
| 1669 Send(new ViewMsg_AutoFillSuggestionsReturned( | 1677 Send(new ViewMsg_AutoFillSuggestionsReturned( |
| 1670 routing_id(), query_id, autofill_values_, autofill_labels_)); | 1678 routing_id(), query_id, autofill_values_, autofill_labels_)); |
| 1671 } | 1679 } |
| 1672 | 1680 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 const string16& name, | 1935 const string16& name, |
| 1928 const string16& display_name, | 1936 const string16& display_name, |
| 1929 unsigned long estimated_size, | 1937 unsigned long estimated_size, |
| 1930 bool blocked_by_policy) { | 1938 bool blocked_by_policy) { |
| 1931 RenderViewHostDelegate::ContentSettings* content_settings_delegate = | 1939 RenderViewHostDelegate::ContentSettings* content_settings_delegate = |
| 1932 delegate_->GetContentSettingsDelegate(); | 1940 delegate_->GetContentSettingsDelegate(); |
| 1933 if (content_settings_delegate) | 1941 if (content_settings_delegate) |
| 1934 content_settings_delegate->OnWebDatabaseAccessed( | 1942 content_settings_delegate->OnWebDatabaseAccessed( |
| 1935 url, name, display_name, estimated_size, blocked_by_policy); | 1943 url, name, display_name, estimated_size, blocked_by_policy); |
| 1936 } | 1944 } |
| OLD | NEW |