| 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/autofill_metrics.h" |
| 26 #include "components/autofill/core/browser/card_unmask_delegate.h" | 27 #include "components/autofill/core/browser/card_unmask_delegate.h" |
| 27 #include "components/autofill/core/browser/form_structure.h" | 28 #include "components/autofill/core/browser/form_structure.h" |
| 28 #include "components/autofill/core/browser/personal_data_manager.h" | 29 #include "components/autofill/core/browser/personal_data_manager.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 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 void OnLoadedServerPredictions(const std::string& response_xml) override; | 225 void OnLoadedServerPredictions(const std::string& response_xml) override; |
| 225 | 226 |
| 226 // CardUnmaskDelegate: | 227 // CardUnmaskDelegate: |
| 227 void OnUnmaskResponse(const base::string16& cvc) override; | 228 void OnUnmaskResponse(const base::string16& cvc) override; |
| 228 void OnUnmaskPromptClosed() override; | 229 void OnUnmaskPromptClosed() override; |
| 229 | 230 |
| 230 // A toy method called when the (fake) unmasking process has finished. | 231 // A toy method called when the (fake) unmasking process has finished. |
| 231 void OnUnmaskVerificationResult(bool success); | 232 void OnUnmaskVerificationResult(bool success); |
| 232 | 233 |
| 233 // Returns false if Autofill is disabled or if no Autofill data is available. | 234 // Returns false if Autofill is disabled or if no Autofill data is available. |
| 234 bool RefreshDataModels() const; | 235 bool RefreshDataModels(); |
| 235 | 236 |
| 236 // Unpacks |unique_id| and fills |form_group| and |variant| with the | 237 // Unpacks |unique_id| and fills |form_group| and |variant| with the |
| 237 // appropriate data source and variant index. Sets |is_credit_card| to true | 238 // 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 | 239 // if |data_model| points to a CreditCard data model, false if it's a |
| 239 // profile data model. | 240 // profile data model. |
| 240 // Returns false if the unpacked id cannot be found. | 241 // Returns false if the unpacked id cannot be found. |
| 241 bool GetProfileOrCreditCard(int unique_id, | 242 bool GetProfileOrCreditCard(int unique_id, |
| 242 const AutofillDataModel** data_model, | 243 const AutofillDataModel** data_model, |
| 243 size_t* variant, | 244 size_t* variant, |
| 244 bool* is_credit_card) const WARN_UNUSED_RESULT; | 245 bool* is_credit_card) const WARN_UNUSED_RESULT; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 303 |
| 303 // If |initial_interaction_timestamp_| is unset or is set to a later time than | 304 // If |initial_interaction_timestamp_| is unset or is set to a later time than |
| 304 // |interaction_timestamp|, updates the cached timestamp. The latter check is | 305 // |interaction_timestamp|, updates the cached timestamp. The latter check is |
| 305 // needed because IPC messages can arrive out of order. | 306 // needed because IPC messages can arrive out of order. |
| 306 void UpdateInitialInteractionTimestamp( | 307 void UpdateInitialInteractionTimestamp( |
| 307 const base::TimeTicks& interaction_timestamp); | 308 const base::TimeTicks& interaction_timestamp); |
| 308 | 309 |
| 309 // Shared code to determine if |form| should be uploaded. | 310 // Shared code to determine if |form| should be uploaded. |
| 310 bool ShouldUploadForm(const FormStructure& form); | 311 bool ShouldUploadForm(const FormStructure& form); |
| 311 | 312 |
| 313 // Utility to log the form event. |
| 314 void LogFormEvent(AutofillMetrics::AutofillFormEvent event, |
| 315 bool is_credit_card); |
| 316 |
| 312 // Provides driver-level context to the shared code of the component. Must | 317 // Provides driver-level context to the shared code of the component. Must |
| 313 // outlive this object. | 318 // outlive this object. |
| 314 AutofillDriver* driver_; | 319 AutofillDriver* driver_; |
| 315 | 320 |
| 316 AutofillClient* const client_; | 321 AutofillClient* const client_; |
| 317 | 322 |
| 318 std::string app_locale_; | 323 std::string app_locale_; |
| 319 | 324 |
| 320 // The personal data manager, used to save and load personal data to/from the | 325 // The personal data manager, used to save and load personal data to/from the |
| 321 // web database. This is overridden by the AutofillManagerTest. | 326 // web database. This is overridden by the AutofillManagerTest. |
| 322 // Weak reference. | 327 // Weak reference. |
| 323 // May be NULL. NULL indicates OTR. | 328 // May be NULL. NULL indicates OTR. |
| 324 PersonalDataManager* personal_data_; | 329 PersonalDataManager* personal_data_; |
| 325 | 330 |
| 326 std::list<std::string> autofilled_form_signatures_; | 331 std::list<std::string> autofilled_form_signatures_; |
| 327 | 332 |
| 328 // Handles queries and uploads to Autofill servers. Will be NULL if | 333 // Handles queries and uploads to Autofill servers. Will be NULL if |
| 329 // the download manager functionality is disabled. | 334 // the download manager functionality is disabled. |
| 330 scoped_ptr<AutofillDownloadManager> download_manager_; | 335 scoped_ptr<AutofillDownloadManager> download_manager_; |
| 331 | 336 |
| 332 // Handles single-field autocomplete form data. | 337 // Handles single-field autocomplete form data. |
| 333 scoped_ptr<AutocompleteHistoryManager> autocomplete_history_manager_; | 338 scoped_ptr<AutocompleteHistoryManager> autocomplete_history_manager_; |
| 334 | 339 |
| 340 // Utilities for logging form events. |
| 341 scoped_ptr<AutofillMetrics::FormEventLogger> address_form_event_logger_; |
| 342 scoped_ptr<AutofillMetrics::FormEventLogger> credit_card_form_event_logger_; |
| 343 |
| 335 // Have we logged whether Autofill is enabled for this page load? | 344 // Have we logged whether Autofill is enabled for this page load? |
| 336 bool has_logged_autofill_enabled_; | 345 bool has_logged_autofill_enabled_; |
| 337 // Have we logged an address suggestions count metric for this page? | 346 // Have we logged an address suggestions count metric for this page? |
| 338 bool has_logged_address_suggestions_count_; | 347 bool has_logged_address_suggestions_count_; |
| 339 // Have we shown Autofill suggestions at least once? | 348 // Have we shown Autofill suggestions at least once? |
| 340 bool did_show_suggestions_; | 349 bool did_show_suggestions_; |
| 341 // Has the user manually edited at least one form field among the autofillable | 350 // Has the user manually edited at least one form field among the autofillable |
| 342 // ones? | 351 // ones? |
| 343 bool user_did_type_; | 352 bool user_did_type_; |
| 344 // Has the user autofilled a form on this page? | 353 // Has the user autofilled a form on this page? |
| (...skipping 62 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 |