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

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

Issue 11270018: [autofill] Adding new API to request an interactive autocomplete UI flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: do a barrel roll! Created 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup, 353 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup,
354 OnHideAutofillPopup) 354 OnHideAutofillPopup)
355 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordGenerationPopup, 355 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordGenerationPopup,
356 OnShowPasswordGenerationPopup) 356 OnShowPasswordGenerationPopup)
357 IPC_MESSAGE_HANDLER(AutofillHostMsg_AddPasswordFormMapping, 357 IPC_MESSAGE_HANDLER(AutofillHostMsg_AddPasswordFormMapping,
358 OnAddPasswordFormMapping) 358 OnAddPasswordFormMapping)
359 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordSuggestions, 359 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordSuggestions,
360 OnShowPasswordSuggestions) 360 OnShowPasswordSuggestions)
361 IPC_MESSAGE_HANDLER(AutofillHostMsg_SetDataList, 361 IPC_MESSAGE_HANDLER(AutofillHostMsg_SetDataList,
362 OnSetDataList) 362 OnSetDataList)
363 IPC_MESSAGE_HANDLER(AutofillHostMsg_RequestAutocomplete,
364 OnRequestAutocomplete)
363 IPC_MESSAGE_UNHANDLED(handled = false) 365 IPC_MESSAGE_UNHANDLED(handled = false)
364 IPC_END_MESSAGE_MAP() 366 IPC_END_MESSAGE_MAP()
365 367
366 return handled; 368 return handled;
367 } 369 }
368 370
369 void AutofillManager::WebContentsDestroyed(content::WebContents* web_contents) { 371 void AutofillManager::WebContentsDestroyed(content::WebContents* web_contents) {
370 ProfileSyncServiceBase* service = manager_delegate_->GetProfileSyncService(); 372 ProfileSyncServiceBase* service = manager_delegate_->GetProfileSyncService();
371 if (service && service->HasObserver(this)) 373 if (service && service->HasObserver(this))
372 service->RemoveObserver(this); 374 service->RemoveObserver(this);
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 const std::vector<string16>& icons, 792 const std::vector<string16>& icons,
791 const std::vector<int>& unique_ids) { 793 const std::vector<int>& unique_ids) {
792 if (external_delegate_) { 794 if (external_delegate_) {
793 external_delegate_->SetCurrentDataListValues(values, 795 external_delegate_->SetCurrentDataListValues(values,
794 labels, 796 labels,
795 icons, 797 icons,
796 unique_ids); 798 unique_ids);
797 } 799 }
798 } 800 }
799 801
802 void AutofillManager::OnRequestAutocomplete(const FormData& form) {
803 // TODO(dbeam): implement interactive autocomplete UI.
804
805 RenderViewHost* host = web_contents()->GetRenderViewHost();
806 if (!host)
807 return;
808
809 // Just send a cancel right away.
810 host->Send(
811 new AutofillMsg_RequestAutocompleteFinished(host->GetRoutingID(), true));
812 }
813
800 void AutofillManager::OnLoadedServerPredictions( 814 void AutofillManager::OnLoadedServerPredictions(
801 const std::string& response_xml) { 815 const std::string& response_xml) {
802 // Parse and store the server predictions. 816 // Parse and store the server predictions.
803 FormStructure::ParseQueryResponse(response_xml, 817 FormStructure::ParseQueryResponse(response_xml,
804 form_structures_.get(), 818 form_structures_.get(),
805 *metric_logger_); 819 *metric_logger_);
806 820
807 // If the corresponding flag is set, annotate forms with the predicted types. 821 // If the corresponding flag is set, annotate forms with the predicted types.
808 SendAutofillTypePredictions(form_structures_.get()); 822 SendAutofillTypePredictions(form_structures_.get());
809 } 823 }
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 *profile_guid = IDToGUID(profile_id); 1427 *profile_guid = IDToGUID(profile_id);
1414 } 1428 }
1415 1429
1416 void AutofillManager::UpdateInitialInteractionTimestamp( 1430 void AutofillManager::UpdateInitialInteractionTimestamp(
1417 const TimeTicks& interaction_timestamp) { 1431 const TimeTicks& interaction_timestamp) {
1418 if (initial_interaction_timestamp_.is_null() || 1432 if (initial_interaction_timestamp_.is_null() ||
1419 interaction_timestamp < initial_interaction_timestamp_) { 1433 interaction_timestamp < initial_interaction_timestamp_) {
1420 initial_interaction_timestamp_ = interaction_timestamp; 1434 initial_interaction_timestamp_ = interaction_timestamp;
1421 } 1435 }
1422 } 1436 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698