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

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

Issue 9600038: Add Password Autofill Manager to New Autofill (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove frame id Created 8 years, 9 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
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "content/public/browser/render_view_host.h" 50 #include "content/public/browser/render_view_host.h"
51 #include "content/public/browser/web_contents.h" 51 #include "content/public/browser/web_contents.h"
52 #include "googleurl/src/gurl.h" 52 #include "googleurl/src/gurl.h"
53 #include "grit/generated_resources.h" 53 #include "grit/generated_resources.h"
54 #include "ipc/ipc_message_macros.h" 54 #include "ipc/ipc_message_macros.h"
55 #include "ui/base/l10n/l10n_util.h" 55 #include "ui/base/l10n/l10n_util.h"
56 #include "ui/gfx/rect.h" 56 #include "ui/gfx/rect.h"
57 #include "webkit/forms/form_data.h" 57 #include "webkit/forms/form_data.h"
58 #include "webkit/forms/form_data_predictions.h" 58 #include "webkit/forms/form_data_predictions.h"
59 #include "webkit/forms/form_field.h" 59 #include "webkit/forms/form_field.h"
60 #include "webkit/forms/password_form_dom_manager.h"
60 61
61 using base::TimeTicks; 62 using base::TimeTicks;
62 using content::BrowserThread; 63 using content::BrowserThread;
63 using content::RenderViewHost; 64 using content::RenderViewHost;
64 using switches::kEnableAutofillFeedback; 65 using switches::kEnableAutofillFeedback;
65 using webkit::forms::FormData; 66 using webkit::forms::FormData;
66 using webkit::forms::FormDataPredictions; 67 using webkit::forms::FormDataPredictions;
67 using webkit::forms::FormField; 68 using webkit::forms::FormField;
68 69
69 namespace { 70 namespace {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 kAutofillNegativeUploadRateDefaultValue, 289 kAutofillNegativeUploadRateDefaultValue,
289 PrefService::UNSYNCABLE_PREF); 290 PrefService::UNSYNCABLE_PREF);
290 } 291 }
291 292
292 void AutofillManager::DidNavigateMainFrame( 293 void AutofillManager::DidNavigateMainFrame(
293 const content::LoadCommittedDetails& details, 294 const content::LoadCommittedDetails& details,
294 const content::FrameNavigateParams& params) { 295 const content::FrameNavigateParams& params) {
295 Reset(); 296 Reset();
296 } 297 }
297 298
299 bool AutofillManager::HasExternalDelegate() {
300 return external_delegate_ != NULL;
301 }
302
298 bool AutofillManager::OnMessageReceived(const IPC::Message& message) { 303 bool AutofillManager::OnMessageReceived(const IPC::Message& message) {
299 bool handled = true; 304 bool handled = true;
300 IPC_BEGIN_MESSAGE_MAP(AutofillManager, message) 305 IPC_BEGIN_MESSAGE_MAP(AutofillManager, message)
301 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormsSeen, OnFormsSeen) 306 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormsSeen, OnFormsSeen)
302 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormSubmitted, OnFormSubmitted) 307 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormSubmitted, OnFormSubmitted)
303 IPC_MESSAGE_HANDLER(AutofillHostMsg_TextFieldDidChange, 308 IPC_MESSAGE_HANDLER(AutofillHostMsg_TextFieldDidChange,
304 OnTextFieldDidChange) 309 OnTextFieldDidChange)
305 IPC_MESSAGE_HANDLER(AutofillHostMsg_QueryFormFieldAutofill, 310 IPC_MESSAGE_HANDLER(AutofillHostMsg_QueryFormFieldAutofill,
306 OnQueryFormFieldAutofill) 311 OnQueryFormFieldAutofill)
307 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowAutofillDialog, 312 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowAutofillDialog,
308 OnShowAutofillDialog) 313 OnShowAutofillDialog)
309 IPC_MESSAGE_HANDLER(AutofillHostMsg_FillAutofillFormData, 314 IPC_MESSAGE_HANDLER(AutofillHostMsg_FillAutofillFormData,
310 OnFillAutofillFormData) 315 OnFillAutofillFormData)
311 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData, 316 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData,
312 OnDidPreviewAutofillFormData) 317 OnDidPreviewAutofillFormData)
313 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData, 318 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData,
314 OnDidFillAutofillFormData) 319 OnDidFillAutofillFormData)
315 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions, 320 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions,
316 OnDidShowAutofillSuggestions) 321 OnDidShowAutofillSuggestions)
317 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidEndTextFieldEditing, 322 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidEndTextFieldEditing,
318 OnDidEndTextFieldEditing) 323 OnDidEndTextFieldEditing)
319 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup, 324 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup,
320 OnHideAutofillPopup) 325 OnHideAutofillPopup)
326 IPC_MESSAGE_HANDLER(AutofillHostMsg_FrameClosing,
327 OnFrameClosing)
328 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordFormMapping,
329 OnPasswordFormMapping)
321 IPC_MESSAGE_UNHANDLED(handled = false) 330 IPC_MESSAGE_UNHANDLED(handled = false)
322 IPC_END_MESSAGE_MAP() 331 IPC_END_MESSAGE_MAP()
323 332
324 return handled; 333 return handled;
325 } 334 }
326 335
327 bool AutofillManager::OnFormSubmitted(const FormData& form, 336 bool AutofillManager::OnFormSubmitted(const FormData& form,
328 const TimeTicks& timestamp) { 337 const TimeTicks& timestamp) {
329 // Let AutoComplete know as well. 338 // Let AutoComplete know as well.
330 tab_contents_wrapper_->autocomplete_history_manager()->OnFormSubmitted(form); 339 tab_contents_wrapper_->autocomplete_history_manager()->OnFormSubmitted(form);
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); 693 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE);
685 } 694 }
686 } 695 }
687 } 696 }
688 697
689 void AutofillManager::OnHideAutofillPopup() { 698 void AutofillManager::OnHideAutofillPopup() {
690 if (external_delegate_) 699 if (external_delegate_)
691 external_delegate_->HideAutofillPopup(); 700 external_delegate_->HideAutofillPopup();
692 } 701 }
693 702
703 void AutofillManager::OnFrameClosing() {
704 if (external_delegate_)
705 external_delegate_->FrameClosing();
706 }
707
708 void AutofillManager::OnPasswordFormMapping(
709 const webkit::forms::FormField& form,
710 const webkit::forms::PasswordFormFillData fill_data) {
711 if (external_delegate_)
712 external_delegate_->PasswordFormMapping(form, fill_data);
713 }
714
715
694 void AutofillManager::OnLoadedServerPredictions( 716 void AutofillManager::OnLoadedServerPredictions(
695 const std::string& response_xml) { 717 const std::string& response_xml) {
696 // Parse and store the server predictions. 718 // Parse and store the server predictions.
697 FormStructure::ParseQueryResponse(response_xml, 719 FormStructure::ParseQueryResponse(response_xml,
698 form_structures_.get(), 720 form_structures_.get(),
699 *metric_logger_); 721 *metric_logger_);
700 722
701 // If the corresponding flag is set, annotate forms with the predicted types. 723 // If the corresponding flag is set, annotate forms with the predicted types.
702 SendAutofillTypePredictions(form_structures_.get()); 724 SendAutofillTypePredictions(form_structures_.get());
703 } 725 }
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 *profile_guid = IDToGUID(profile_id); 1323 *profile_guid = IDToGUID(profile_id);
1302 } 1324 }
1303 1325
1304 void AutofillManager::UpdateInitialInteractionTimestamp( 1326 void AutofillManager::UpdateInitialInteractionTimestamp(
1305 const TimeTicks& interaction_timestamp) { 1327 const TimeTicks& interaction_timestamp) {
1306 if (initial_interaction_timestamp_.is_null() || 1328 if (initial_interaction_timestamp_.is_null() ||
1307 interaction_timestamp < initial_interaction_timestamp_) { 1329 interaction_timestamp < initial_interaction_timestamp_) {
1308 initial_interaction_timestamp_ = interaction_timestamp; 1330 initial_interaction_timestamp_ = interaction_timestamp;
1309 } 1331 }
1310 } 1332 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698