| 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 <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 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/memory/scoped_ptr.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 "components/autofill/core/browser/autocomplete_history_manager.h" | 22 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
| 23 #include "components/autofill/core/browser/autofill_client.h" | 23 #include "components/autofill/core/browser/autofill_client.h" |
| 24 #include "components/autofill/core/browser/autofill_download_manager.h" | 24 #include "components/autofill/core/browser/autofill_download_manager.h" |
| 25 #include "components/autofill/core/browser/autofill_driver.h" | 25 #include "components/autofill/core/browser/autofill_driver.h" |
| 26 #include "components/autofill/core/browser/card_unmask_delegate.h" | 26 #include "components/autofill/core/browser/card_unmask_delegate.h" |
| 27 #include "components/autofill/core/browser/form_structure.h" | 27 #include "components/autofill/core/browser/form_structure.h" |
| 28 #include "components/autofill/core/browser/personal_data_manager.h" | 28 #include "components/autofill/core/browser/personal_data_manager.h" |
| 29 #include "components/autofill/core/browser/wallet/real_pan_wallet_client.h" |
| 29 #include "components/autofill/core/common/form_data.h" | 30 #include "components/autofill/core/common/form_data.h" |
| 30 | 31 |
| 31 namespace gfx { | 32 namespace gfx { |
| 32 class Rect; | 33 class Rect; |
| 33 class RectF; | 34 class RectF; |
| 34 } | 35 } |
| 35 | 36 |
| 36 namespace user_prefs { | 37 namespace user_prefs { |
| 37 class PrefRegistrySyncable; | 38 class PrefRegistrySyncable; |
| 38 } | 39 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 49 class AutofillType; | 50 class AutofillType; |
| 50 class CreditCard; | 51 class CreditCard; |
| 51 class FormStructureBrowserTest; | 52 class FormStructureBrowserTest; |
| 52 | 53 |
| 53 struct FormData; | 54 struct FormData; |
| 54 struct FormFieldData; | 55 struct FormFieldData; |
| 55 | 56 |
| 56 // Manages saving and restoring the user's personal information entered into web | 57 // Manages saving and restoring the user's personal information entered into web |
| 57 // forms. One per frame; owned by the AutofillDriver. | 58 // forms. One per frame; owned by the AutofillDriver. |
| 58 class AutofillManager : public AutofillDownloadManager::Observer, | 59 class AutofillManager : public AutofillDownloadManager::Observer, |
| 59 public CardUnmaskDelegate { | 60 public CardUnmaskDelegate, |
| 61 public wallet::RealPanWalletClient::Delegate { |
| 60 public: | 62 public: |
| 61 enum AutofillDownloadManagerState { | 63 enum AutofillDownloadManagerState { |
| 62 ENABLE_AUTOFILL_DOWNLOAD_MANAGER, | 64 ENABLE_AUTOFILL_DOWNLOAD_MANAGER, |
| 63 DISABLE_AUTOFILL_DOWNLOAD_MANAGER, | 65 DISABLE_AUTOFILL_DOWNLOAD_MANAGER, |
| 64 }; | 66 }; |
| 65 | 67 |
| 66 // Registers our Enable/Disable Autofill pref. | 68 // Registers our Enable/Disable Autofill pref. |
| 67 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 69 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 68 | 70 |
| 69 #if defined(OS_MACOSX) && !defined(OS_IOS) | 71 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 222 } |
| 221 | 223 |
| 222 private: | 224 private: |
| 223 // AutofillDownloadManager::Observer: | 225 // AutofillDownloadManager::Observer: |
| 224 void OnLoadedServerPredictions(const std::string& response_xml) override; | 226 void OnLoadedServerPredictions(const std::string& response_xml) override; |
| 225 | 227 |
| 226 // CardUnmaskDelegate: | 228 // CardUnmaskDelegate: |
| 227 void OnUnmaskResponse(const base::string16& cvc) override; | 229 void OnUnmaskResponse(const base::string16& cvc) override; |
| 228 void OnUnmaskPromptClosed() override; | 230 void OnUnmaskPromptClosed() override; |
| 229 | 231 |
| 232 // wallet::RealPanWalletClient::Delegate: |
| 233 void OnDidGetRealPan(const std::string& real_pan) override; |
| 234 std::string GetOAuth2Token() override; |
| 235 |
| 230 // A toy method called when the (fake) unmasking process has finished. | 236 // A toy method called when the (fake) unmasking process has finished. |
| 231 void OnUnmaskVerificationResult(bool success); | 237 void OnUnmaskVerificationResult(bool success); |
| 232 | 238 |
| 233 // Returns false if Autofill is disabled or if no Autofill data is available. | 239 // Returns false if Autofill is disabled or if no Autofill data is available. |
| 234 bool RefreshDataModels() const; | 240 bool RefreshDataModels() const; |
| 235 | 241 |
| 236 // Unpacks |unique_id| and fills |form_group| and |variant| with the | 242 // Unpacks |unique_id| and fills |form_group| and |variant| with the |
| 237 // appropriate data source and variant index. Sets |is_credit_card| to true | 243 // appropriate data source and variant index. Sets |is_credit_card| to true |
| 238 // if |data_model| points to a CreditCard data model, false if it's a | 244 // if |data_model| points to a CreditCard data model, false if it's a |
| 239 // profile data model. | 245 // profile data model. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 314 |
| 309 // Shared code to determine if |form| should be uploaded. | 315 // Shared code to determine if |form| should be uploaded. |
| 310 bool ShouldUploadForm(const FormStructure& form); | 316 bool ShouldUploadForm(const FormStructure& form); |
| 311 | 317 |
| 312 // Provides driver-level context to the shared code of the component. Must | 318 // Provides driver-level context to the shared code of the component. Must |
| 313 // outlive this object. | 319 // outlive this object. |
| 314 AutofillDriver* driver_; | 320 AutofillDriver* driver_; |
| 315 | 321 |
| 316 AutofillClient* const client_; | 322 AutofillClient* const client_; |
| 317 | 323 |
| 324 // Handles real PAN requests. |
| 325 wallet::RealPanWalletClient real_pan_client_; |
| 326 |
| 318 std::string app_locale_; | 327 std::string app_locale_; |
| 319 | 328 |
| 320 // The personal data manager, used to save and load personal data to/from the | 329 // The personal data manager, used to save and load personal data to/from the |
| 321 // web database. This is overridden by the AutofillManagerTest. | 330 // web database. This is overridden by the AutofillManagerTest. |
| 322 // Weak reference. | 331 // Weak reference. |
| 323 // May be NULL. NULL indicates OTR. | 332 // May be NULL. NULL indicates OTR. |
| 324 PersonalDataManager* personal_data_; | 333 PersonalDataManager* personal_data_; |
| 325 | 334 |
| 326 std::list<std::string> autofilled_form_signatures_; | 335 std::list<std::string> autofilled_form_signatures_; |
| 327 | 336 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, | 416 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, |
| 408 AutocompleteOffRespected); | 417 AutocompleteOffRespected); |
| 409 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, | 418 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, |
| 410 AutocompleteOffRespectedWithFlag); | 419 AutocompleteOffRespectedWithFlag); |
| 411 DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 420 DISALLOW_COPY_AND_ASSIGN(AutofillManager); |
| 412 }; | 421 }; |
| 413 | 422 |
| 414 } // namespace autofill | 423 } // namespace autofill |
| 415 | 424 |
| 416 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ | 425 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ |
| OLD | NEW |