Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 6 #define CHROME_BROWSER_AUTOFILL_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/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.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/prefs/public/pref_change_registrar.h" | 20 #include "base/prefs/public/pref_change_registrar.h" |
| 21 #include "base/string16.h" | 21 #include "base/string16.h" |
| 22 #include "base/time.h" | 22 #include "base/time.h" |
| 23 #include "chrome/browser/api/sync/profile_sync_service_observer.h" | 23 #include "chrome/browser/api/sync/profile_sync_service_observer.h" |
| 24 #include "chrome/browser/autofill/autocheckout_manager.h" | |
| 24 #include "chrome/browser/autofill/autocomplete_history_manager.h" | 25 #include "chrome/browser/autofill/autocomplete_history_manager.h" |
| 25 #include "chrome/browser/autofill/autofill_download.h" | 26 #include "chrome/browser/autofill/autofill_download.h" |
| 26 #include "chrome/browser/autofill/field_types.h" | 27 #include "chrome/browser/autofill/field_types.h" |
| 27 #include "chrome/browser/autofill/form_structure.h" | 28 #include "chrome/browser/autofill/form_structure.h" |
| 28 #include "chrome/browser/autofill/personal_data_manager.h" | 29 #include "chrome/browser/autofill/personal_data_manager.h" |
| 29 #include "chrome/common/autofill/autocheckout_status.h" | 30 #include "chrome/common/autofill/autocheckout_status.h" |
| 31 #include "chrome/common/form_data.h" | |
| 30 #include "content/public/browser/web_contents_observer.h" | 32 #include "content/public/browser/web_contents_observer.h" |
| 31 #include "content/public/common/ssl_status.h" | 33 #include "content/public/common/ssl_status.h" |
| 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" |
| 33 | 35 |
| 34 class AutofillExternalDelegate; | 36 class AutofillExternalDelegate; |
| 35 class AutofillField; | 37 class AutofillField; |
| 36 class AutofillProfile; | 38 class AutofillProfile; |
| 37 class AutofillMetrics; | 39 class AutofillMetrics; |
| 38 class CreditCard; | 40 class CreditCard; |
| 39 class FormGroup; | 41 class FormGroup; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 int max_length, | 102 int max_length, |
| 101 const content::PasswordForm& form); | 103 const content::PasswordForm& form); |
| 102 | 104 |
| 103 // Remove the credit card or Autofill profile that matches |unique_id| | 105 // Remove the credit card or Autofill profile that matches |unique_id| |
| 104 // from the database. | 106 // from the database. |
| 105 void RemoveAutofillProfileOrCreditCard(int unique_id); | 107 void RemoveAutofillProfileOrCreditCard(int unique_id); |
| 106 | 108 |
| 107 // Remove the specified Autocomplete entry. | 109 // Remove the specified Autocomplete entry. |
| 108 void RemoveAutocompleteEntry(const string16& name, const string16& value); | 110 void RemoveAutocompleteEntry(const string16& name, const string16& value); |
| 109 | 111 |
| 112 // Returns the present web_contents state. | |
| 113 content::WebContents* GetWebContents() const; | |
|
Ilya Sherman
2013/01/18 01:45:02
nit: This method should either return a const refe
Raman Kakilate
2013/01/18 04:22:30
Done.
| |
| 114 | |
| 110 protected: | 115 protected: |
| 111 // Only test code should subclass AutofillManager. | 116 // Only test code should subclass AutofillManager. |
| 112 friend class base::RefCounted<AutofillManager>; | 117 friend class base::RefCounted<AutofillManager>; |
| 113 | 118 |
| 114 AutofillManager(content::WebContents* web_contents, | 119 AutofillManager(content::WebContents* web_contents, |
| 115 autofill::AutofillManagerDelegate* delegate); | 120 autofill::AutofillManagerDelegate* delegate); |
| 116 virtual ~AutofillManager(); | 121 virtual ~AutofillManager(); |
| 117 | 122 |
| 118 // Test code should prefer to use this constructor. | 123 // Test code should prefer to use this constructor. |
| 119 AutofillManager(content::WebContents* web_contents, | 124 AutofillManager(content::WebContents* web_contents, |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 | 334 |
| 330 // Should be set to true in AutofillManagerTest and other tests, false in | 335 // Should be set to true in AutofillManagerTest and other tests, false in |
| 331 // AutofillDownloadManagerTest and in non-test environment. Is false by | 336 // AutofillDownloadManagerTest and in non-test environment. Is false by |
| 332 // default for the public constructor, and true by default for the test-only | 337 // default for the public constructor, and true by default for the test-only |
| 333 // constructors. | 338 // constructors. |
| 334 bool disable_download_manager_requests_; | 339 bool disable_download_manager_requests_; |
| 335 | 340 |
| 336 // Handles single-field autocomplete form data. | 341 // Handles single-field autocomplete form data. |
| 337 AutocompleteHistoryManager autocomplete_history_manager_; | 342 AutocompleteHistoryManager autocomplete_history_manager_; |
| 338 | 343 |
| 344 // Handles autocheckout flows. | |
| 345 AutocheckoutManager autocheckout_manager_; | |
| 346 | |
| 339 // For logging UMA metrics. Overridden by metrics tests. | 347 // For logging UMA metrics. Overridden by metrics tests. |
| 340 scoped_ptr<const AutofillMetrics> metric_logger_; | 348 scoped_ptr<const AutofillMetrics> metric_logger_; |
| 341 // Have we logged whether Autofill is enabled for this page load? | 349 // Have we logged whether Autofill is enabled for this page load? |
| 342 bool has_logged_autofill_enabled_; | 350 bool has_logged_autofill_enabled_; |
| 343 // Have we logged an address suggestions count metric for this page? | 351 // Have we logged an address suggestions count metric for this page? |
| 344 bool has_logged_address_suggestions_count_; | 352 bool has_logged_address_suggestions_count_; |
| 345 // Have we shown Autofill suggestions at least once? | 353 // Have we shown Autofill suggestions at least once? |
| 346 bool did_show_suggestions_; | 354 bool did_show_suggestions_; |
| 347 // Has the user manually edited at least one form field among the autofillable | 355 // Has the user manually edited at least one form field among the autofillable |
| 348 // ones? | 356 // ones? |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, | 407 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, |
| 400 TestTabContentsWithExternalDelegate); | 408 TestTabContentsWithExternalDelegate); |
| 401 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, | 409 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, |
| 402 UserHappinessFormLoadAndSubmission); | 410 UserHappinessFormLoadAndSubmission); |
| 403 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); | 411 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); |
| 404 | 412 |
| 405 DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 413 DISALLOW_COPY_AND_ASSIGN(AutofillManager); |
| 406 }; | 414 }; |
| 407 | 415 |
| 408 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 416 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
| OLD | NEW |