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

Side by Side Diff: components/autofill/core/browser/autofill_manager.h

Issue 1859453002: components/autofill: scoped_ptr -> unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <memory>
10 #include <string> 11 #include <string>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/callback_forward.h" 14 #include "base/callback_forward.h"
14 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
15 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/scoped_vector.h" 18 #include "base/memory/scoped_vector.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "components/autofill/core/browser/autocomplete_history_manager.h" 23 #include "components/autofill/core/browser/autocomplete_history_manager.h"
24 #include "components/autofill/core/browser/autofill_client.h" 24 #include "components/autofill/core/browser/autofill_client.h"
25 #include "components/autofill/core/browser/autofill_download_manager.h" 25 #include "components/autofill/core/browser/autofill_download_manager.h"
26 #include "components/autofill/core/browser/autofill_driver.h" 26 #include "components/autofill/core/browser/autofill_driver.h"
27 #include "components/autofill/core/browser/autofill_metrics.h" 27 #include "components/autofill/core/browser/autofill_metrics.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // if this form is not relevant for Autofill. 161 // if this form is not relevant for Autofill.
162 bool OnWillSubmitForm(const FormData& form, const base::TimeTicks& timestamp); 162 bool OnWillSubmitForm(const FormData& form, const base::TimeTicks& timestamp);
163 163
164 // Processes the submitted |form|, saving any new Autofill data to the user's 164 // Processes the submitted |form|, saving any new Autofill data to the user's
165 // personal profile. Returns false if this form is not relevant for Autofill. 165 // personal profile. Returns false if this form is not relevant for Autofill.
166 bool OnFormSubmitted(const FormData& form); 166 bool OnFormSubmitted(const FormData& form);
167 167
168 // Will send an upload based on the |form_structure| data and the local 168 // Will send an upload based on the |form_structure| data and the local
169 // Autofill profile data. |observed_submission| is specified if the upload 169 // Autofill profile data. |observed_submission| is specified if the upload
170 // follows an observed submission event. 170 // follows an observed submission event.
171 void StartUploadProcess(scoped_ptr<FormStructure> form_structure, 171 void StartUploadProcess(std::unique_ptr<FormStructure> form_structure,
172 const base::TimeTicks& timestamp, 172 const base::TimeTicks& timestamp,
173 bool observed_submission); 173 bool observed_submission);
174 174
175 // Update the pending form with |form|, possibly processing the current 175 // Update the pending form with |form|, possibly processing the current
176 // pending form for upload. 176 // pending form for upload.
177 void UpdatePendingForm(const FormData& form); 177 void UpdatePendingForm(const FormData& form);
178 178
179 // Upload the current pending form. 179 // Upload the current pending form.
180 void ProcessPendingFormForUpload(); 180 void ProcessPendingFormForUpload();
181 181
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 void OnUnmaskResponse(const UnmaskResponse& response) override; 271 void OnUnmaskResponse(const UnmaskResponse& response) override;
272 void OnUnmaskPromptClosed() override; 272 void OnUnmaskPromptClosed() override;
273 273
274 // payments::PaymentsClientDelegate: 274 // payments::PaymentsClientDelegate:
275 IdentityProvider* GetIdentityProvider() override; 275 IdentityProvider* GetIdentityProvider() override;
276 void OnDidGetRealPan(AutofillClient::PaymentsRpcResult result, 276 void OnDidGetRealPan(AutofillClient::PaymentsRpcResult result,
277 const std::string& real_pan) override; 277 const std::string& real_pan) override;
278 void OnDidGetUploadDetails( 278 void OnDidGetUploadDetails(
279 AutofillClient::PaymentsRpcResult result, 279 AutofillClient::PaymentsRpcResult result,
280 const base::string16& context_token, 280 const base::string16& context_token,
281 scoped_ptr<base::DictionaryValue> legal_message) override; 281 std::unique_ptr<base::DictionaryValue> legal_message) override;
282 void OnDidUploadCard(AutofillClient::PaymentsRpcResult result) override; 282 void OnDidUploadCard(AutofillClient::PaymentsRpcResult result) override;
283 283
284 // Saves risk data in |unmasking_risk_data_| and calls UnmaskCard if the user 284 // Saves risk data in |unmasking_risk_data_| and calls UnmaskCard if the user
285 // has accepted the prompt. 285 // has accepted the prompt.
286 void OnDidGetUnmaskRiskData(const std::string& risk_data); 286 void OnDidGetUnmaskRiskData(const std::string& risk_data);
287 287
288 // Sets |user_did_accept_upload_prompt_| and calls UploadCard if the risk data 288 // Sets |user_did_accept_upload_prompt_| and calls UploadCard if the risk data
289 // is available. 289 // is available.
290 void OnUserDidAcceptUpload(); 290 void OnUserDidAcceptUpload();
291 291
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 void FillOrPreviewDataModelForm(AutofillDriver::RendererFormDataAction action, 335 void FillOrPreviewDataModelForm(AutofillDriver::RendererFormDataAction action,
336 int query_id, 336 int query_id,
337 const FormData& form, 337 const FormData& form,
338 const FormFieldData& field, 338 const FormFieldData& field,
339 const AutofillDataModel& data_model, 339 const AutofillDataModel& data_model,
340 bool is_credit_card); 340 bool is_credit_card);
341 341
342 // Creates a FormStructure using the FormData received from the renderer. Will 342 // Creates a FormStructure using the FormData received from the renderer. Will
343 // return an empty scoped_ptr if the data should not be processed for upload 343 // return an empty scoped_ptr if the data should not be processed for upload
344 // or personal data. 344 // or personal data.
345 scoped_ptr<FormStructure> ValidateSubmittedForm(const FormData& form); 345 std::unique_ptr<FormStructure> ValidateSubmittedForm(const FormData& form);
346 346
347 // Fills |form_structure| cached element corresponding to |form|. 347 // Fills |form_structure| cached element corresponding to |form|.
348 // Returns false if the cached element was not found. 348 // Returns false if the cached element was not found.
349 bool FindCachedForm(const FormData& form, 349 bool FindCachedForm(const FormData& form,
350 FormStructure** form_structure) const WARN_UNUSED_RESULT; 350 FormStructure** form_structure) const WARN_UNUSED_RESULT;
351 351
352 // Fills |form_structure| and |autofill_field| with the cached elements 352 // Fills |form_structure| and |autofill_field| with the cached elements
353 // corresponding to |form| and |field|. This might have the side-effect of 353 // corresponding to |form| and |field|. This might have the side-effect of
354 // updating the cache. Returns false if the |form| is not autofillable, or if 354 // updating the cache. Returns false if the |form| is not autofillable, or if
355 // it is not already present in the cache and the cache is full. 355 // it is not already present in the cache and the cache is full.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 void DumpAutofillData(bool imported_cc) const; 439 void DumpAutofillData(bool imported_cc) const;
440 #endif 440 #endif
441 441
442 // Provides driver-level context to the shared code of the component. Must 442 // Provides driver-level context to the shared code of the component. Must
443 // outlive this object. 443 // outlive this object.
444 AutofillDriver* driver_; 444 AutofillDriver* driver_;
445 445
446 AutofillClient* const client_; 446 AutofillClient* const client_;
447 447
448 // Handles Payments service requests. 448 // Handles Payments service requests.
449 scoped_ptr<payments::PaymentsClient> payments_client_; 449 std::unique_ptr<payments::PaymentsClient> payments_client_;
450 450
451 std::string app_locale_; 451 std::string app_locale_;
452 452
453 // The personal data manager, used to save and load personal data to/from the 453 // The personal data manager, used to save and load personal data to/from the
454 // web database. This is overridden by the AutofillManagerTest. 454 // web database. This is overridden by the AutofillManagerTest.
455 // Weak reference. 455 // Weak reference.
456 // May be NULL. NULL indicates OTR. 456 // May be NULL. NULL indicates OTR.
457 PersonalDataManager* personal_data_; 457 PersonalDataManager* personal_data_;
458 458
459 std::deque<std::string> autofilled_form_signatures_; 459 std::deque<std::string> autofilled_form_signatures_;
460 460
461 // Handles queries and uploads to Autofill servers. Will be NULL if 461 // Handles queries and uploads to Autofill servers. Will be NULL if
462 // the download manager functionality is disabled. 462 // the download manager functionality is disabled.
463 scoped_ptr<AutofillDownloadManager> download_manager_; 463 std::unique_ptr<AutofillDownloadManager> download_manager_;
464 464
465 // Handles single-field autocomplete form data. 465 // Handles single-field autocomplete form data.
466 scoped_ptr<AutocompleteHistoryManager> autocomplete_history_manager_; 466 std::unique_ptr<AutocompleteHistoryManager> autocomplete_history_manager_;
467 467
468 // Utilities for logging form events. 468 // Utilities for logging form events.
469 scoped_ptr<AutofillMetrics::FormEventLogger> address_form_event_logger_; 469 std::unique_ptr<AutofillMetrics::FormEventLogger> address_form_event_logger_;
470 scoped_ptr<AutofillMetrics::FormEventLogger> credit_card_form_event_logger_; 470 std::unique_ptr<AutofillMetrics::FormEventLogger>
471 credit_card_form_event_logger_;
471 472
472 // Have we logged whether Autofill is enabled for this page load? 473 // Have we logged whether Autofill is enabled for this page load?
473 bool has_logged_autofill_enabled_; 474 bool has_logged_autofill_enabled_;
474 // Have we logged an address suggestions count metric for this page? 475 // Have we logged an address suggestions count metric for this page?
475 bool has_logged_address_suggestions_count_; 476 bool has_logged_address_suggestions_count_;
476 // Have we shown Autofill suggestions at least once? 477 // Have we shown Autofill suggestions at least once?
477 bool did_show_suggestions_; 478 bool did_show_suggestions_;
478 // Has the user manually edited at least one form field among the autofillable 479 // Has the user manually edited at least one form field among the autofillable
479 // ones? 480 // ones?
480 bool user_did_type_; 481 bool user_did_type_;
481 // Has the user autofilled a form on this page? 482 // Has the user autofilled a form on this page?
482 bool user_did_autofill_; 483 bool user_did_autofill_;
483 // Has the user edited a field that was previously autofilled? 484 // Has the user edited a field that was previously autofilled?
484 bool user_did_edit_autofilled_field_; 485 bool user_did_edit_autofilled_field_;
485 // When the form finished loading. 486 // When the form finished loading.
486 std::map<FormData, base::TimeTicks> forms_loaded_timestamps_; 487 std::map<FormData, base::TimeTicks> forms_loaded_timestamps_;
487 // When the user first interacted with a potentially fillable form on this 488 // When the user first interacted with a potentially fillable form on this
488 // page. 489 // page.
489 base::TimeTicks initial_interaction_timestamp_; 490 base::TimeTicks initial_interaction_timestamp_;
490 491
491 // Our copy of the form data. 492 // Our copy of the form data.
492 ScopedVector<FormStructure> form_structures_; 493 ScopedVector<FormStructure> form_structures_;
493 494
494 // A copy of the currently interacted form data. 495 // A copy of the currently interacted form data.
495 scoped_ptr<FormData> pending_form_data_; 496 std::unique_ptr<FormData> pending_form_data_;
496 497
497 // Collected information about a pending unmask request, and data about the 498 // Collected information about a pending unmask request, and data about the
498 // form. 499 // form.
499 payments::PaymentsClient::UnmaskRequestDetails unmask_request_; 500 payments::PaymentsClient::UnmaskRequestDetails unmask_request_;
500 int unmasking_query_id_; 501 int unmasking_query_id_;
501 FormData unmasking_form_; 502 FormData unmasking_form_;
502 FormFieldData unmasking_field_; 503 FormFieldData unmasking_field_;
503 // Time when we requested the last real pan. 504 // Time when we requested the last real pan.
504 base::Time real_pan_request_timestamp_; 505 base::Time real_pan_request_timestamp_;
505 506
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, 584 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest,
584 DontSaveCvcInAutocompleteHistory); 585 DontSaveCvcInAutocompleteHistory);
585 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, DontOfferToSavePaymentsCard); 586 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, DontOfferToSavePaymentsCard);
586 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, FillInUpdatedExpirationDate); 587 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, FillInUpdatedExpirationDate);
587 DISALLOW_COPY_AND_ASSIGN(AutofillManager); 588 DISALLOW_COPY_AND_ASSIGN(AutofillManager);
588 }; 589 };
589 590
590 } // namespace autofill 591 } // namespace autofill
591 592
592 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ 593 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698