| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ |
| 6 #define CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/ui/zoom/zoom_observer.h" | 13 #include "chrome/browser/ui/zoom/zoom_observer.h" |
| 13 #include "components/autofill/core/browser/autofill_client.h" | 14 #include "components/autofill/core/browser/autofill_client.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 15 #include "content/public/browser/web_contents_user_data.h" | 16 #include "content/public/browser/web_contents_user_data.h" |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 struct FrameNavigateParams; | 19 struct FrameNavigateParams; |
| 19 struct LoadCommittedDetails; | 20 struct LoadCommittedDetails; |
| 20 class WebContents; | 21 class WebContents; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace autofill { | 24 namespace autofill { |
| 24 | 25 |
| 25 class AutofillDialogController; | 26 class AutofillDialogController; |
| 26 class AutofillKeystoneBridgeWrapper; | 27 class AutofillKeystoneBridgeWrapper; |
| 27 class AutofillPopupControllerImpl; | 28 class AutofillPopupControllerImpl; |
| 28 class CreditCardScannerController; | 29 class CreditCardScannerController; |
| 30 class InstrumentUnmaskPromptView; |
| 29 struct FormData; | 31 struct FormData; |
| 30 | 32 |
| 31 // Chrome implementation of AutofillClient. | 33 // Chrome implementation of AutofillClient. |
| 32 class ChromeAutofillClient | 34 class ChromeAutofillClient |
| 33 : public AutofillClient, | 35 : public AutofillClient, |
| 34 public content::WebContentsUserData<ChromeAutofillClient>, | 36 public content::WebContentsUserData<ChromeAutofillClient>, |
| 35 public content::WebContentsObserver, | 37 public content::WebContentsObserver, |
| 36 public ZoomObserver { | 38 public ZoomObserver { |
| 37 public: | 39 public: |
| 38 ~ChromeAutofillClient() override; | 40 ~ChromeAutofillClient() override; |
| 39 | 41 |
| 40 // Called when the tab corresponding to |this| instance is activated. | 42 // Called when the tab corresponding to |this| instance is activated. |
| 41 void TabActivated(); | 43 void TabActivated(); |
| 42 | 44 |
| 43 // AutofillClient: | 45 // AutofillClient: |
| 44 PersonalDataManager* GetPersonalDataManager() override; | 46 PersonalDataManager* GetPersonalDataManager() override; |
| 45 scoped_refptr<AutofillWebDataService> GetDatabase() override; | 47 scoped_refptr<AutofillWebDataService> GetDatabase() override; |
| 46 PrefService* GetPrefs() override; | 48 PrefService* GetPrefs() override; |
| 47 void HideRequestAutocompleteDialog() override; | 49 void HideRequestAutocompleteDialog() override; |
| 48 void ShowAutofillSettings() override; | 50 void ShowAutofillSettings() override; |
| 51 void ShowUnmaskPrompt() override; |
| 49 void ConfirmSaveCreditCard(const AutofillMetrics& metric_logger, | 52 void ConfirmSaveCreditCard(const AutofillMetrics& metric_logger, |
| 50 const base::Closure& save_card_callback) override; | 53 const base::Closure& save_card_callback) override; |
| 51 bool HasCreditCardScanFeature() override; | 54 bool HasCreditCardScanFeature() override; |
| 52 void ScanCreditCard(const CreditCardScanCallback& callback) override; | 55 void ScanCreditCard(const CreditCardScanCallback& callback) override; |
| 53 void ShowRequestAutocompleteDialog(const FormData& form, | 56 void ShowRequestAutocompleteDialog(const FormData& form, |
| 54 const GURL& source_url, | 57 const GURL& source_url, |
| 55 const ResultCallback& callback) override; | 58 const ResultCallback& callback) override; |
| 56 void ShowAutofillPopup( | 59 void ShowAutofillPopup( |
| 57 const gfx::RectF& element_bounds, | 60 const gfx::RectF& element_bounds, |
| 58 base::i18n::TextDirection text_direction, | 61 base::i18n::TextDirection text_direction, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 89 private: | 92 private: |
| 90 #if defined(OS_MACOSX) && !defined(OS_IOS) | 93 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 91 // Creates |bridge_wrapper_|, which is responsible for dealing with Keystone | 94 // Creates |bridge_wrapper_|, which is responsible for dealing with Keystone |
| 92 // notifications. | 95 // notifications. |
| 93 void RegisterForKeystoneNotifications(); | 96 void RegisterForKeystoneNotifications(); |
| 94 | 97 |
| 95 // Deletes |bridge_wrapper_|. | 98 // Deletes |bridge_wrapper_|. |
| 96 void UnregisterFromKeystoneNotifications(); | 99 void UnregisterFromKeystoneNotifications(); |
| 97 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 100 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 98 | 101 |
| 102 void OnUnmaskResponse(const base::string16& response); |
| 103 |
| 99 explicit ChromeAutofillClient(content::WebContents* web_contents); | 104 explicit ChromeAutofillClient(content::WebContents* web_contents); |
| 100 friend class content::WebContentsUserData<ChromeAutofillClient>; | 105 friend class content::WebContentsUserData<ChromeAutofillClient>; |
| 101 | 106 |
| 102 content::WebContents* const web_contents_; | 107 content::WebContents* const web_contents_; |
| 103 base::WeakPtr<AutofillDialogController> dialog_controller_; | 108 base::WeakPtr<AutofillDialogController> dialog_controller_; |
| 104 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; | 109 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; |
| 110 scoped_ptr<InstrumentUnmaskPromptView> unmask_prompt_; |
| 105 | 111 |
| 106 #if defined(OS_MACOSX) && !defined(OS_IOS) | 112 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 107 // Listens to Keystone notifications and passes relevant ones on to the | 113 // Listens to Keystone notifications and passes relevant ones on to the |
| 108 // PersonalDataManager. | 114 // PersonalDataManager. |
| 109 // | 115 // |
| 110 // The class of this member must remain a forward declaration, even in the | 116 // The class of this member must remain a forward declaration, even in the |
| 111 // .cc implementation file, since the class is defined in a Mac-only | 117 // .cc implementation file, since the class is defined in a Mac-only |
| 112 // implementation file. This means that the pointer cannot be wrapped in a | 118 // implementation file. This means that the pointer cannot be wrapped in a |
| 113 // scoped_ptr. | 119 // scoped_ptr. |
| 114 AutofillKeystoneBridgeWrapper* bridge_wrapper_; | 120 AutofillKeystoneBridgeWrapper* bridge_wrapper_; |
| 115 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 121 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 116 | 122 |
| 117 DISALLOW_COPY_AND_ASSIGN(ChromeAutofillClient); | 123 DISALLOW_COPY_AND_ASSIGN(ChromeAutofillClient); |
| 118 }; | 124 }; |
| 119 | 125 |
| 120 } // namespace autofill | 126 } // namespace autofill |
| 121 | 127 |
| 122 #endif // CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ | 128 #endif // CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ |
| OLD | NEW |