| OLD | NEW |
| 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 <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/scoped_vector.h" | |
| 19 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 20 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
| 21 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 22 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 23 #include "components/autofill/core/browser/autocomplete_history_manager.h" | 22 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
| 24 #include "components/autofill/core/browser/autofill_client.h" | 23 #include "components/autofill/core/browser/autofill_client.h" |
| 25 #include "components/autofill/core/browser/autofill_download_manager.h" | 24 #include "components/autofill/core/browser/autofill_download_manager.h" |
| 26 #include "components/autofill/core/browser/autofill_driver.h" | 25 #include "components/autofill/core/browser/autofill_driver.h" |
| 27 #include "components/autofill/core/browser/autofill_metrics.h" | 26 #include "components/autofill/core/browser/autofill_metrics.h" |
| 28 #include "components/autofill/core/browser/card_unmask_delegate.h" | 27 #include "components/autofill/core/browser/card_unmask_delegate.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 bool RemoveAutofillProfileOrCreditCard(int unique_id); | 133 bool RemoveAutofillProfileOrCreditCard(int unique_id); |
| 135 | 134 |
| 136 // Remove the specified Autocomplete entry. | 135 // Remove the specified Autocomplete entry. |
| 137 void RemoveAutocompleteEntry(const base::string16& name, | 136 void RemoveAutocompleteEntry(const base::string16& name, |
| 138 const base::string16& value); | 137 const base::string16& value); |
| 139 | 138 |
| 140 // Returns true when the Payments card unmask prompt is being displayed. | 139 // Returns true when the Payments card unmask prompt is being displayed. |
| 141 bool IsShowingUnmaskPrompt(); | 140 bool IsShowingUnmaskPrompt(); |
| 142 | 141 |
| 143 // Returns the present form structures seen by Autofill manager. | 142 // Returns the present form structures seen by Autofill manager. |
| 144 const std::vector<FormStructure*>& GetFormStructures(); | 143 const std::vector<std::unique_ptr<FormStructure>>& GetFormStructures(); |
| 145 | 144 |
| 146 AutofillClient* client() { return client_; } | 145 AutofillClient* client() { return client_; } |
| 147 | 146 |
| 148 AutofillDownloadManager* download_manager() { | 147 AutofillDownloadManager* download_manager() { |
| 149 return download_manager_.get(); | 148 return download_manager_.get(); |
| 150 } | 149 } |
| 151 | 150 |
| 152 payments::FullCardRequest* GetOrCreateFullCardRequest(); | 151 payments::FullCardRequest* GetOrCreateFullCardRequest(); |
| 153 | 152 |
| 154 const std::string& app_locale() const { return app_locale_; } | 153 const std::string& app_locale() const { return app_locale_; } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 virtual std::string IntToBackendID(int int_id) const; | 245 virtual std::string IntToBackendID(int int_id) const; |
| 247 | 246 |
| 248 // Methods for packing and unpacking credit card and profile IDs for sending | 247 // Methods for packing and unpacking credit card and profile IDs for sending |
| 249 // and receiving to and from the renderer process. | 248 // and receiving to and from the renderer process. |
| 250 int MakeFrontendID(const std::string& cc_backend_id, | 249 int MakeFrontendID(const std::string& cc_backend_id, |
| 251 const std::string& profile_backend_id) const; | 250 const std::string& profile_backend_id) const; |
| 252 void SplitFrontendID(int frontend_id, | 251 void SplitFrontendID(int frontend_id, |
| 253 std::string* cc_backend_id, | 252 std::string* cc_backend_id, |
| 254 std::string* profile_backend_id) const; | 253 std::string* profile_backend_id) const; |
| 255 | 254 |
| 256 ScopedVector<FormStructure>* form_structures() { return &form_structures_; } | 255 std::vector<std::unique_ptr<FormStructure>>* form_structures() { |
| 256 return &form_structures_; |
| 257 } |
| 257 | 258 |
| 258 // Exposed for testing. | 259 // Exposed for testing. |
| 259 AutofillExternalDelegate* external_delegate() { | 260 AutofillExternalDelegate* external_delegate() { |
| 260 return external_delegate_; | 261 return external_delegate_; |
| 261 } | 262 } |
| 262 | 263 |
| 263 // Exposed for testing. | 264 // Exposed for testing. |
| 264 void set_download_manager(AutofillDownloadManager* manager) { | 265 void set_download_manager(AutofillDownloadManager* manager) { |
| 265 download_manager_.reset(manager); | 266 download_manager_.reset(manager); |
| 266 } | 267 } |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 bool user_did_autofill_; | 492 bool user_did_autofill_; |
| 492 // Has the user edited a field that was previously autofilled? | 493 // Has the user edited a field that was previously autofilled? |
| 493 bool user_did_edit_autofilled_field_; | 494 bool user_did_edit_autofilled_field_; |
| 494 // When the form finished loading. | 495 // When the form finished loading. |
| 495 std::map<FormData, base::TimeTicks> forms_loaded_timestamps_; | 496 std::map<FormData, base::TimeTicks> forms_loaded_timestamps_; |
| 496 // When the user first interacted with a potentially fillable form on this | 497 // When the user first interacted with a potentially fillable form on this |
| 497 // page. | 498 // page. |
| 498 base::TimeTicks initial_interaction_timestamp_; | 499 base::TimeTicks initial_interaction_timestamp_; |
| 499 | 500 |
| 500 // Our copy of the form data. | 501 // Our copy of the form data. |
| 501 ScopedVector<FormStructure> form_structures_; | 502 std::vector<std::unique_ptr<FormStructure>> form_structures_; |
| 502 | 503 |
| 503 // A copy of the currently interacted form data. | 504 // A copy of the currently interacted form data. |
| 504 std::unique_ptr<FormData> pending_form_data_; | 505 std::unique_ptr<FormData> pending_form_data_; |
| 505 | 506 |
| 506 // Responsible for getting the full card details, including the PAN and the | 507 // Responsible for getting the full card details, including the PAN and the |
| 507 // CVC. | 508 // CVC. |
| 508 std::unique_ptr<payments::FullCardRequest> full_card_request_; | 509 std::unique_ptr<payments::FullCardRequest> full_card_request_; |
| 509 | 510 |
| 510 // Collected information about the autofill form where unmasked card will be | 511 // Collected information about the autofill form where unmasked card will be |
| 511 // filled. | 512 // filled. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, | 586 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, |
| 586 OnLoadedServerPredictions_ResetManager); | 587 OnLoadedServerPredictions_ResetManager); |
| 587 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, DontOfferToSavePaymentsCard); | 588 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, DontOfferToSavePaymentsCard); |
| 588 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, FillInUpdatedExpirationDate); | 589 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, FillInUpdatedExpirationDate); |
| 589 DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 590 DISALLOW_COPY_AND_ASSIGN(AutofillManager); |
| 590 }; | 591 }; |
| 591 | 592 |
| 592 } // namespace autofill | 593 } // namespace autofill |
| 593 | 594 |
| 594 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ | 595 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ |
| OLD | NEW |