| 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/autocomplete_history_manager.h" |   24 #include "chrome/browser/autofill/autocomplete_history_manager.h" | 
|   25 #include "chrome/browser/autofill/autofill_download.h" |   25 #include "chrome/browser/autofill/autofill_download.h" | 
|   26 #include "chrome/browser/autofill/field_types.h" |   26 #include "chrome/browser/autofill/field_types.h" | 
|   27 #include "chrome/browser/autofill/form_structure.h" |   27 #include "chrome/browser/autofill/form_structure.h" | 
|   28 #include "chrome/browser/autofill/personal_data_manager.h" |   28 #include "chrome/browser/autofill/personal_data_manager.h" | 
 |   29 #include "chrome/common/form_data.h" | 
|   29 #include "content/public/browser/web_contents_observer.h" |   30 #include "content/public/browser/web_contents_observer.h" | 
|   30 #include "content/public/common/ssl_status.h" |   31 #include "content/public/common/ssl_status.h" | 
|   31  |   32  | 
|   32 class AutofillExternalDelegate; |   33 class AutofillExternalDelegate; | 
|   33 class AutofillField; |   34 class AutofillField; | 
|   34 class AutofillProfile; |   35 class AutofillProfile; | 
|   35 class AutofillMetrics; |   36 class AutofillMetrics; | 
|   36 class CreditCard; |   37 class CreditCard; | 
|   37 class FormGroup; |   38 class FormGroup; | 
|   38 class GURL; |   39 class GURL; | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   98                                      int max_length, |   99                                      int max_length, | 
|   99                                      const content::PasswordForm& form); |  100                                      const content::PasswordForm& form); | 
|  100  |  101  | 
|  101   // Remove the credit card or Autofill profile that matches |unique_id| |  102   // Remove the credit card or Autofill profile that matches |unique_id| | 
|  102   // from the database. |  103   // from the database. | 
|  103   void RemoveAutofillProfileOrCreditCard(int unique_id); |  104   void RemoveAutofillProfileOrCreditCard(int unique_id); | 
|  104  |  105  | 
|  105   // Remove the specified Autocomplete entry. |  106   // Remove the specified Autocomplete entry. | 
|  106   void RemoveAutocompleteEntry(const string16& name, const string16& value); |  107   void RemoveAutocompleteEntry(const string16& name, const string16& value); | 
|  107  |  108  | 
 |  109   virtual void ShowAutofillFlowDialog(const FormData& form, | 
 |  110                                       const GURL& frame_url, | 
 |  111                                       const content::SSLStatus& ssl_status); | 
 |  112  | 
|  108  protected: |  113  protected: | 
|  109   // Only test code should subclass AutofillManager. |  114   // Only test code should subclass AutofillManager. | 
|  110   friend class base::RefCounted<AutofillManager>; |  115   friend class base::RefCounted<AutofillManager>; | 
|  111  |  116  | 
|  112   AutofillManager(content::WebContents* web_contents, |  117   AutofillManager(content::WebContents* web_contents, | 
|  113                   autofill::AutofillManagerDelegate* delegate); |  118                   autofill::AutofillManagerDelegate* delegate); | 
|  114   virtual ~AutofillManager(); |  119   virtual ~AutofillManager(); | 
|  115  |  120  | 
|  116   // Test code should prefer to use this constructor. |  121   // Test code should prefer to use this constructor. | 
|  117   AutofillManager(content::WebContents* web_contents, |  122   AutofillManager(content::WebContents* web_contents, | 
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  230                      const std::vector<int>& unique_ids); |  235                      const std::vector<int>& unique_ids); | 
|  231  |  236  | 
|  232   // Requests an interactive autocomplete UI be shown. |  237   // Requests an interactive autocomplete UI be shown. | 
|  233   void OnRequestAutocomplete(const FormData& form, |  238   void OnRequestAutocomplete(const FormData& form, | 
|  234                              const GURL& frame_url, |  239                              const GURL& frame_url, | 
|  235                              const content::SSLStatus& ssl_status); |  240                              const content::SSLStatus& ssl_status); | 
|  236  |  241  | 
|  237   // Passes return data for an OnRequestAutocomplete call back to the page. |  242   // Passes return data for an OnRequestAutocomplete call back to the page. | 
|  238   void ReturnAutocompleteData(const FormStructure* result); |  243   void ReturnAutocompleteData(const FormStructure* result); | 
|  239  |  244  | 
 |  245   // Passes return data for an ShowAutofillFlowDialog call back to the page. | 
 |  246   void ReturnAutofillFlowData(const FormStructure* result); | 
 |  247  | 
|  240   // Fills |host| with the RenderViewHost for this tab. |  248   // Fills |host| with the RenderViewHost for this tab. | 
|  241   // Returns false if Autofill is disabled or if the host is unavailable. |  249   // Returns false if Autofill is disabled or if the host is unavailable. | 
|  242   bool GetHost(content::RenderViewHost** host) const WARN_UNUSED_RESULT; |  250   bool GetHost(content::RenderViewHost** host) const WARN_UNUSED_RESULT; | 
|  243  |  251  | 
|  244   // Unpacks |unique_id| and fills |form_group| and |variant| with the |  252   // Unpacks |unique_id| and fills |form_group| and |variant| with the | 
|  245   // appropriate data source and variant index.  Returns false if the unpacked |  253   // appropriate data source and variant index.  Returns false if the unpacked | 
|  246   // id cannot be found. |  254   // id cannot be found. | 
|  247   bool GetProfileOrCreditCard(int unique_id, |  255   bool GetProfileOrCreditCard(int unique_id, | 
|  248                               const FormGroup** form_group, |  256                               const FormGroup** form_group, | 
|  249                               size_t* variant) const WARN_UNUSED_RESULT; |  257                               size_t* variant) const WARN_UNUSED_RESULT; | 
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  393   FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, |  401   FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, | 
|  394                            TestTabContentsWithExternalDelegate); |  402                            TestTabContentsWithExternalDelegate); | 
|  395   FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, |  403   FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, | 
|  396                            UserHappinessFormLoadAndSubmission); |  404                            UserHappinessFormLoadAndSubmission); | 
|  397   FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); |  405   FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); | 
|  398  |  406  | 
|  399   DISALLOW_COPY_AND_ASSIGN(AutofillManager); |  407   DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 
|  400 }; |  408 }; | 
|  401  |  409  | 
|  402 #endif  // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |  410 #endif  // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 
| OLD | NEW |