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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_ 7 8 #include <string> 9 10 #include "base/callback.h" 11 #include "base/memory/weak_ptr.h" 12 #include "base/strings/string16.h" 13 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" 14 #include "components/autofill/content/browser/autocheckout_steps.h" 15 #include "components/autofill/core/browser/form_structure.h" 16 17 class GURL; 18 19 namespace content { 20 class WebContents; 21 } 22 23 namespace user_prefs { 24 class PrefRegistrySyncable; 25 } 26 27 namespace autofill { 28 29 // This class defines the interface to the controller for TabAutofillManager. 30 class AutofillDialogController { 31 public: 32 virtual ~AutofillDialogController(); 33 34 // Creates the AutofillDialogController. 35 static base::WeakPtr<AutofillDialogController> Create( 36 content::WebContents* contents, 37 const FormData& form_structure, 38 const GURL& source_url, 39 const DialogType dialog_type, 40 const base::Callback<void(const FormStructure*, 41 const std::string&)>& callback); 42 43 // Registers profile preferences. 44 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 45 46 // Shows the Autofill dialog. 47 virtual void Show() = 0; 48 49 // Hides the Autofill dialog. 50 virtual void Hide() = 0; 51 52 // Called when the tab hosting this dialog is activated by a user gesture. 53 // Used to trigger a refresh of the user's Wallet data. 54 virtual void TabActivated() = 0; 55 56 // Adds a step in the flow to the Autocheckout UI. 57 virtual void AddAutocheckoutStep(AutocheckoutStepType step_type) = 0; 58 59 // Updates the status of a step in the Autocheckout UI. 60 virtual void UpdateAutocheckoutStep( 61 AutocheckoutStepType step_type, 62 AutocheckoutStepStatus step_status) = 0; 63 64 // Called when there is an error in an active Autocheckout flow. 65 virtual void OnAutocheckoutError() = 0; 66 67 // Called when an Autocheckout flow completes successfully. 68 virtual void OnAutocheckoutSuccess() = 0; 69 70 // Returns the dialog type. 71 virtual DialogType GetDialogType() const = 0; 72 }; 73 74 } // namespace autofill 75 76 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_H_ 77