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

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

Issue 11185011: Remove TabContents from autofill unittests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove some Created 8 years, 2 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) 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 disable_download_manager_requests_(false), 199 disable_download_manager_requests_(false),
200 metric_logger_(new AutofillMetrics), 200 metric_logger_(new AutofillMetrics),
201 has_logged_autofill_enabled_(false), 201 has_logged_autofill_enabled_(false),
202 has_logged_address_suggestions_count_(false), 202 has_logged_address_suggestions_count_(false),
203 did_show_suggestions_(false), 203 did_show_suggestions_(false),
204 user_did_type_(false), 204 user_did_type_(false),
205 user_did_autofill_(false), 205 user_did_autofill_(false),
206 user_did_edit_autofilled_field_(false), 206 user_did_edit_autofilled_field_(false),
207 password_generation_enabled_(false), 207 password_generation_enabled_(false),
208 external_delegate_(NULL) { 208 external_delegate_(NULL) {
209 // The AutofillManager requires the AutocompleteHistoryManager.
210 AutocompleteHistoryManager::CreateForWebContents(web_contents);
Avi (use Gerrit) 2012/10/16 22:04:28 This is a very interesting question. Is the Autoco
Ilya Sherman 2012/10/19 00:05:27 I think that's reasonable.
209 // |personal_data_| is NULL when using test-enabled WebContents. 211 // |personal_data_| is NULL when using test-enabled WebContents.
210 personal_data_ = PersonalDataManagerFactory::GetForProfile( 212 personal_data_ = PersonalDataManagerFactory::GetForProfile(
211 delegate->GetOriginalProfile()); 213 delegate->GetOriginalProfile());
212 RegisterWithSyncService(); 214 RegisterWithSyncService();
213 registrar_.Init(manager_delegate_->GetPrefs()); 215 registrar_.Init(manager_delegate_->GetPrefs());
214 registrar_.Add(prefs::kPasswordGenerationEnabled, this); 216 registrar_.Add(prefs::kPasswordGenerationEnabled, this);
215 } 217 }
216 218
217 AutofillManager::~AutofillManager() { 219 AutofillManager::~AutofillManager() {
218 } 220 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 false); 311 false);
310 } 312 }
311 } 313 }
312 314
313 void AutofillManager::DidNavigateMainFrame( 315 void AutofillManager::DidNavigateMainFrame(
314 const content::LoadCommittedDetails& details, 316 const content::LoadCommittedDetails& details,
315 const content::FrameNavigateParams& params) { 317 const content::FrameNavigateParams& params) {
316 Reset(); 318 Reset();
317 } 319 }
318 320
321 void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) {
322 // TODO(jrg): consider passing delegate into the ctor. That won't
323 // work if the delegate has a pointer to the AutofillManager, but
324 // future directions may not need such a pointer.
325 external_delegate_ = delegate;
326 AutocompleteHistoryManager::FromWebContents(web_contents())->
327 SetExternalDelegate(delegate);
328 }
329
319 bool AutofillManager::HasExternalDelegate() { 330 bool AutofillManager::HasExternalDelegate() {
320 return external_delegate_ != NULL; 331 return external_delegate_ != NULL;
321 } 332 }
322 333
323 bool AutofillManager::OnMessageReceived(const IPC::Message& message) { 334 bool AutofillManager::OnMessageReceived(const IPC::Message& message) {
324 bool handled = true; 335 bool handled = true;
325 IPC_BEGIN_MESSAGE_MAP(AutofillManager, message) 336 IPC_BEGIN_MESSAGE_MAP(AutofillManager, message)
326 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormsSeen, OnFormsSeen) 337 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormsSeen, OnFormsSeen)
327 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormSubmitted, OnFormSubmitted) 338 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormSubmitted, OnFormSubmitted)
328 IPC_MESSAGE_HANDLER(AutofillHostMsg_TextFieldDidChange, 339 IPC_MESSAGE_HANDLER(AutofillHostMsg_TextFieldDidChange,
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 has_logged_autofill_enabled_(false), 918 has_logged_autofill_enabled_(false),
908 has_logged_address_suggestions_count_(false), 919 has_logged_address_suggestions_count_(false),
909 did_show_suggestions_(false), 920 did_show_suggestions_(false),
910 user_did_type_(false), 921 user_did_type_(false),
911 user_did_autofill_(false), 922 user_did_autofill_(false),
912 user_did_edit_autofilled_field_(false), 923 user_did_edit_autofilled_field_(false),
913 password_generation_enabled_(false), 924 password_generation_enabled_(false),
914 external_delegate_(NULL) { 925 external_delegate_(NULL) {
915 DCHECK(web_contents); 926 DCHECK(web_contents);
916 DCHECK(manager_delegate_); 927 DCHECK(manager_delegate_);
928 // The AutofillManager requires the AutocompleteHistoryManager.
929 AutocompleteHistoryManager::CreateForWebContents(web_contents);
917 RegisterWithSyncService(); 930 RegisterWithSyncService();
918 // Test code doesn't need registrar_. 931 // Test code doesn't need registrar_.
919 } 932 }
920 933
921 void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) { 934 void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) {
922 metric_logger_.reset(metric_logger); 935 metric_logger_.reset(metric_logger);
923 } 936 }
924 937
925 bool AutofillManager::GetHost(const std::vector<AutofillProfile*>& profiles, 938 bool AutofillManager::GetHost(const std::vector<AutofillProfile*>& profiles,
926 const std::vector<CreditCard*>& credit_cards, 939 const std::vector<CreditCard*>& credit_cards,
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 *profile_guid = IDToGUID(profile_id); 1413 *profile_guid = IDToGUID(profile_id);
1401 } 1414 }
1402 1415
1403 void AutofillManager::UpdateInitialInteractionTimestamp( 1416 void AutofillManager::UpdateInitialInteractionTimestamp(
1404 const TimeTicks& interaction_timestamp) { 1417 const TimeTicks& interaction_timestamp) {
1405 if (initial_interaction_timestamp_.is_null() || 1418 if (initial_interaction_timestamp_.is_null() ||
1406 interaction_timestamp < initial_interaction_timestamp_) { 1419 interaction_timestamp < initial_interaction_timestamp_) {
1407 initial_interaction_timestamp_ = interaction_timestamp; 1420 initial_interaction_timestamp_ = interaction_timestamp;
1408 } 1421 }
1409 } 1422 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698