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

Side by Side Diff: chrome/browser/autocomplete_history_manager.cc

Issue 6294016: Move AutoFill messages into a separate file. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months 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 | Annotate | Revision Log
OLDNEW
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/autocomplete_history_manager.h" 5 #include "chrome/browser/autocomplete_history_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/autofill/credit_card.h" 12 #include "chrome/browser/autofill/credit_card.h"
13 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/renderer_host/render_view_host.h" 15 #include "chrome/browser/renderer_host/render_view_host.h"
16 #include "chrome/browser/tab_contents/tab_contents.h" 16 #include "chrome/browser/tab_contents/tab_contents.h"
17 #include "chrome/common/autofill_messages.h"
17 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
18 #include "chrome/common/render_messages.h"
19 #include "webkit/glue/form_data.h" 19 #include "webkit/glue/form_data.h"
20 20
21 using webkit_glue::FormData; 21 using webkit_glue::FormData;
22 22
23 namespace { 23 namespace {
24 24
25 // Limit on the number of suggestions to appear in the pop-up menu under an 25 // Limit on the number of suggestions to appear in the pop-up menu under an
26 // text input element in a form. 26 // text input element in a form.
27 const int kMaxAutocompleteMenuItems = 6; 27 const int kMaxAutocompleteMenuItems = 6;
28 28
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 AutocompleteHistoryManager::~AutocompleteHistoryManager() { 86 AutocompleteHistoryManager::~AutocompleteHistoryManager() {
87 CancelPendingQuery(); 87 CancelPendingQuery();
88 } 88 }
89 89
90 bool AutocompleteHistoryManager::OnMessageReceived( 90 bool AutocompleteHistoryManager::OnMessageReceived(
91 const IPC::Message& message) { 91 const IPC::Message& message) {
92 bool handled = true; 92 bool handled = true;
93 IPC_BEGIN_MESSAGE_MAP(AutocompleteHistoryManager, message) 93 IPC_BEGIN_MESSAGE_MAP(AutocompleteHistoryManager, message)
94 IPC_MESSAGE_HANDLER(ViewHostMsg_RemoveAutocompleteEntry, 94 IPC_MESSAGE_HANDLER(AutoFillHostMsg_RemoveAutocompleteEntry,
95 OnRemoveAutocompleteEntry) 95 OnRemoveAutocompleteEntry)
96 IPC_MESSAGE_UNHANDLED(handled = false) 96 IPC_MESSAGE_UNHANDLED(handled = false)
97 IPC_END_MESSAGE_MAP() 97 IPC_END_MESSAGE_MAP()
98 return handled; 98 return handled;
99 } 99 }
100 100
101 void AutocompleteHistoryManager::OnFormSubmitted(const FormData& form) { 101 void AutocompleteHistoryManager::OnFormSubmitted(const FormData& form) {
102 if (!*autofill_enabled_) 102 if (!*autofill_enabled_)
103 return; 103 return;
104 104
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 autofill_values_.push_back((*suggestions)[i]); 227 autofill_values_.push_back((*suggestions)[i]);
228 autofill_labels_.push_back(string16()); 228 autofill_labels_.push_back(string16());
229 autofill_icons_.push_back(string16()); 229 autofill_icons_.push_back(string16());
230 autofill_unique_ids_.push_back(0); // 0 means no profile. 230 autofill_unique_ids_.push_back(0); // 0 means no profile.
231 } 231 }
232 } 232 }
233 } 233 }
234 234
235 RenderViewHost* host = tab_contents_->render_view_host(); 235 RenderViewHost* host = tab_contents_->render_view_host();
236 if (host) { 236 if (host) {
237 host->Send(new ViewMsg_AutoFillSuggestionsReturned(host->routing_id(), 237 host->Send(new AutoFillMsg_SuggestionsReturned(host->routing_id(),
238 query_id_, 238 query_id_,
239 autofill_values_, 239 autofill_values_,
240 autofill_labels_, 240 autofill_labels_,
241 autofill_icons_, 241 autofill_icons_,
242 autofill_unique_ids_)); 242 autofill_unique_ids_));
243 } 243 }
244 244
245 query_id_ = 0; 245 query_id_ = 0;
246 autofill_values_.clear(); 246 autofill_values_.clear();
247 autofill_labels_.clear(); 247 autofill_labels_.clear();
248 autofill_icons_.clear(); 248 autofill_icons_.clear();
249 autofill_unique_ids_.clear(); 249 autofill_unique_ids_.clear();
250 } 250 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_manager.cc » ('j') | chrome/browser/autofill/autofill_manager_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698