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

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

Issue 8488011: Moving AutofillAgent Logic into Browser (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Initializing form_field variables 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowAutofillDialog, 305 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowAutofillDialog,
306 OnShowAutofillDialog) 306 OnShowAutofillDialog)
307 IPC_MESSAGE_HANDLER(AutofillHostMsg_FillAutofillFormData, 307 IPC_MESSAGE_HANDLER(AutofillHostMsg_FillAutofillFormData,
308 OnFillAutofillFormData) 308 OnFillAutofillFormData)
309 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData, 309 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData,
310 OnDidPreviewAutofillFormData) 310 OnDidPreviewAutofillFormData)
311 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData, 311 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData,
312 OnDidFillAutofillFormData) 312 OnDidFillAutofillFormData)
313 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions, 313 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions,
314 OnDidShowAutofillSuggestions) 314 OnDidShowAutofillSuggestions)
315 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidEndTextFieldEditing,
316 OnDidEndTextFieldEditing)
315 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup, 317 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup,
316 OnHideAutofillPopup) 318 OnHideAutofillPopup)
317 IPC_MESSAGE_UNHANDLED(handled = false) 319 IPC_MESSAGE_UNHANDLED(handled = false)
318 IPC_END_MESSAGE_MAP() 320 IPC_END_MESSAGE_MAP()
319 321
320 return handled; 322 return handled;
321 } 323 }
322 324
323 bool AutofillManager::OnFormSubmitted(const FormData& form, 325 bool AutofillManager::OnFormSubmitted(const FormData& form,
324 const TimeTicks& timestamp) { 326 const TimeTicks& timestamp) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD_ONCE); 438 AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD_ONCE);
437 } 439 }
438 } 440 }
439 441
440 UpdateInitialInteractionTimestamp(timestamp); 442 UpdateInitialInteractionTimestamp(timestamp);
441 } 443 }
442 444
443 void AutofillManager::OnQueryFormFieldAutofill(int query_id, 445 void AutofillManager::OnQueryFormFieldAutofill(int query_id,
444 const FormData& form, 446 const FormData& form,
445 const FormField& field, 447 const FormField& field,
446 const gfx::Rect& bounding_box) { 448 const gfx::Rect& bounding_box,
449 bool display_warning) {
447 std::vector<string16> values; 450 std::vector<string16> values;
448 std::vector<string16> labels; 451 std::vector<string16> labels;
449 std::vector<string16> icons; 452 std::vector<string16> icons;
450 std::vector<int> unique_ids; 453 std::vector<int> unique_ids;
451 454
452 if (external_delegate_) { 455 if (external_delegate_) {
453 external_delegate_->OnQuery(query_id, form, field, bounding_box); 456 external_delegate_->OnQuery(query_id,
457 form,
458 field,
459 bounding_box,
460 display_warning);
454 } 461 }
455 462
456 RenderViewHost* host = NULL; 463 RenderViewHost* host = NULL;
457 FormStructure* form_structure = NULL; 464 FormStructure* form_structure = NULL;
458 AutofillField* autofill_field = NULL; 465 AutofillField* autofill_field = NULL;
459 if (GetHost( 466 if (GetHost(
460 personal_data_->profiles(), personal_data_->credit_cards(), &host) && 467 personal_data_->profiles(), personal_data_->credit_cards(), &host) &&
461 GetCachedFormAndField(form, field, &form_structure, &autofill_field) && 468 GetCachedFormAndField(form, field, &form_structure, &autofill_field) &&
462 // Don't send suggestions for forms that aren't auto-fillable. 469 // Don't send suggestions for forms that aren't auto-fillable.
463 form_structure->IsAutofillable(false)) { 470 form_structure->IsAutofillable(false)) {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 const std::string& response_xml) { 694 const std::string& response_xml) {
688 // Parse and store the server predictions. 695 // Parse and store the server predictions.
689 FormStructure::ParseQueryResponse(response_xml, 696 FormStructure::ParseQueryResponse(response_xml,
690 form_structures_.get(), 697 form_structures_.get(),
691 *metric_logger_); 698 *metric_logger_);
692 699
693 // If the corresponding flag is set, annotate forms with the predicted types. 700 // If the corresponding flag is set, annotate forms with the predicted types.
694 SendAutofillTypePredictions(form_structures_.get()); 701 SendAutofillTypePredictions(form_structures_.get());
695 } 702 }
696 703
704 void AutofillManager::OnDidEndTextFieldEditing() {
705 if (external_delegate_)
706 external_delegate_->DidEndTextFieldEditing();
707 }
708
697 bool AutofillManager::IsAutofillEnabled() const { 709 bool AutofillManager::IsAutofillEnabled() const {
698 Profile* profile = Profile::FromBrowserContext( 710 Profile* profile = Profile::FromBrowserContext(
699 const_cast<AutofillManager*>(this)->tab_contents()->browser_context()); 711 const_cast<AutofillManager*>(this)->tab_contents()->browser_context());
700 return profile->GetPrefs()->GetBoolean(prefs::kAutofillEnabled); 712 return profile->GetPrefs()->GetBoolean(prefs::kAutofillEnabled);
701 } 713 }
702 714
703 void AutofillManager::SendAutofillTypePredictions( 715 void AutofillManager::SendAutofillTypePredictions(
704 const std::vector<FormStructure*>& forms) const { 716 const std::vector<FormStructure*>& forms) const {
705 if (!CommandLine::ForCurrentProcess()->HasSwitch( 717 if (!CommandLine::ForCurrentProcess()->HasSwitch(
706 switches::kShowAutofillTypePredictions)) 718 switches::kShowAutofillTypePredictions))
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 *profile_guid = IDToGUID(profile_id); 1299 *profile_guid = IDToGUID(profile_id);
1288 } 1300 }
1289 1301
1290 void AutofillManager::UpdateInitialInteractionTimestamp( 1302 void AutofillManager::UpdateInitialInteractionTimestamp(
1291 const TimeTicks& interaction_timestamp) { 1303 const TimeTicks& interaction_timestamp) {
1292 if (initial_interaction_timestamp_.is_null() || 1304 if (initial_interaction_timestamp_.is_null() ||
1293 interaction_timestamp < initial_interaction_timestamp_) { 1305 interaction_timestamp < initial_interaction_timestamp_) {
1294 initial_interaction_timestamp_ = interaction_timestamp; 1306 initial_interaction_timestamp_ = interaction_timestamp;
1295 } 1307 }
1296 } 1308 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_manager.h ('k') | chrome/browser/autofill/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698