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

Side by Side Diff: chrome/browser/autofill/autofill_manager.cc

Issue 8490017: Setting up external delegate calls to allow a future delegate to handle autofill (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Adding code review changes Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/autofill/autofill_manager.h" 5 #include "chrome/browser/autofill/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowAutofillDialog, 304 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowAutofillDialog,
305 OnShowAutofillDialog) 305 OnShowAutofillDialog)
306 IPC_MESSAGE_HANDLER(AutofillHostMsg_FillAutofillFormData, 306 IPC_MESSAGE_HANDLER(AutofillHostMsg_FillAutofillFormData,
307 OnFillAutofillFormData) 307 OnFillAutofillFormData)
308 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData, 308 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData,
309 OnDidPreviewAutofillFormData) 309 OnDidPreviewAutofillFormData)
310 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData, 310 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData,
311 OnDidFillAutofillFormData) 311 OnDidFillAutofillFormData)
312 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions, 312 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions,
313 OnDidShowAutofillSuggestions) 313 OnDidShowAutofillSuggestions)
314 IPC_MESSAGE_HANDLER(AutofillHostMsg_AutofillElementBounds,
315 OnSetAutofillElementBounds)
316 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup,
317 OnHideAutofillPopup)
314 IPC_MESSAGE_UNHANDLED(handled = false) 318 IPC_MESSAGE_UNHANDLED(handled = false)
315 IPC_END_MESSAGE_MAP() 319 IPC_END_MESSAGE_MAP()
316 320
317 return handled; 321 return handled;
318 } 322 }
319 323
320 bool AutofillManager::OnFormSubmitted(const FormData& form, 324 bool AutofillManager::OnFormSubmitted(const FormData& form,
321 const TimeTicks& timestamp) { 325 const TimeTicks& timestamp) {
322 // Let AutoComplete know as well. 326 // Let AutoComplete know as well.
323 tab_contents_wrapper_->autocomplete_history_manager()->OnFormSubmitted(form); 327 tab_contents_wrapper_->autocomplete_history_manager()->OnFormSubmitted(form);
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 metric_logger_->LogUserHappinessMetric(AutofillMetrics::SUGGESTIONS_SHOWN); 670 metric_logger_->LogUserHappinessMetric(AutofillMetrics::SUGGESTIONS_SHOWN);
667 671
668 if (!did_show_suggestions_) { 672 if (!did_show_suggestions_) {
669 did_show_suggestions_ = true; 673 did_show_suggestions_ = true;
670 metric_logger_->LogUserHappinessMetric( 674 metric_logger_->LogUserHappinessMetric(
671 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); 675 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE);
672 } 676 }
673 } 677 }
674 } 678 }
675 679
680 void AutofillManager::OnShowAutofillSuggestions(
681 int query_id,
682 const std::vector<string16>& autofill_values,
683 const std::vector<string16>& autofill_labels,
684 const std::vector<string16>& autofill_icons,
685 const std::vector<int>& autofill_unique_ids) {
686 external_delegate_->OnSuggestionsReturned(query_id,
687 autofill_values,
688 autofill_labels,
689 autofill_icons,
690 autofill_unique_ids);
691 external_delegate_->ShowAutofillPopup();
692 }
693
694 void AutofillManager::OnSetAutofillElementBounds(
695 int x,
696 int y,
697 int width,
698 int height) {
699 external_delegate_->SetAutofillElementBounds(gfx::Rect(x, y, width, height));
700 }
701
702 void AutofillManager::OnHideAutofillPopup() {
703 external_delegate_->HideAutofillPopup();
704 }
705
676 void AutofillManager::OnLoadedServerPredictions( 706 void AutofillManager::OnLoadedServerPredictions(
677 const std::string& response_xml) { 707 const std::string& response_xml) {
678 // Parse and store the server predictions. 708 // Parse and store the server predictions.
679 FormStructure::ParseQueryResponse(response_xml, 709 FormStructure::ParseQueryResponse(response_xml,
680 form_structures_.get(), 710 form_structures_.get(),
681 *metric_logger_); 711 *metric_logger_);
682 712
683 // If the corresponding flag is set, annotate forms with the predicted types. 713 // If the corresponding flag is set, annotate forms with the predicted types.
684 SendAutofillTypePredictions(form_structures_.get()); 714 SendAutofillTypePredictions(form_structures_.get());
685 } 715 }
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 *profile_guid = IDToGUID(profile_id); 1307 *profile_guid = IDToGUID(profile_id);
1278 } 1308 }
1279 1309
1280 void AutofillManager::UpdateInitialInteractionTimestamp( 1310 void AutofillManager::UpdateInitialInteractionTimestamp(
1281 const TimeTicks& interaction_timestamp) { 1311 const TimeTicks& interaction_timestamp) {
1282 if (initial_interaction_timestamp_.is_null() || 1312 if (initial_interaction_timestamp_.is_null() ||
1283 interaction_timestamp < initial_interaction_timestamp_) { 1313 interaction_timestamp < initial_interaction_timestamp_) {
1284 initial_interaction_timestamp_ = interaction_timestamp; 1314 initial_interaction_timestamp_ = interaction_timestamp;
1285 } 1315 }
1286 } 1316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698