OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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_ANDROID_AUTOFILL_AUTOFILL_DIALOG_TAB_MANAGER_DELEGATE_
ANDROID_H_ |
| 6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_TAB_MANAGER_DELEGATE_
ANDROID_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 #include "base/android/jni_string.h" |
| 11 #include "base/android/scoped_java_ref.h" |
| 12 #include "base/time/time.h" |
| 13 #include "chrome/browser/ui/autofill/autofill_dialog_tab_manager_delegate.h" |
| 14 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 15 |
| 16 class Profile; |
| 17 |
| 18 namespace user_prefs { |
| 19 class PrefRegistrySyncable; |
| 20 } |
| 21 |
| 22 namespace autofill { |
| 23 |
| 24 // TODO(aruslan): name and description; should be moved into a separate .h. |
| 25 class AutofillDialogTabManagerDelegateAndroid |
| 26 : public AutofillDialogTabManagerDelegate { |
| 27 public: |
| 28 static base::WeakPtr<AutofillDialogTabManagerDelegate> Create( |
| 29 content::WebContents* contents, |
| 30 const FormData& form_structure, |
| 31 const GURL& source_url, |
| 32 const DialogType dialog_type, |
| 33 const base::Callback<void(const FormStructure*, |
| 34 const std::string&)>& callback); |
| 35 |
| 36 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 37 |
| 38 virtual ~AutofillDialogTabManagerDelegateAndroid(); |
| 39 |
| 40 // AutofillDialogTabManagerDelegate: |
| 41 virtual void Show() OVERRIDE; |
| 42 virtual void Hide() OVERRIDE; |
| 43 virtual void TabActivated() OVERRIDE; |
| 44 virtual void AddAutocheckoutStep(AutocheckoutStepType step_type) OVERRIDE; |
| 45 virtual void UpdateAutocheckoutStep( |
| 46 AutocheckoutStepType step_type, |
| 47 AutocheckoutStepStatus step_status) OVERRIDE; |
| 48 virtual void OnAutocheckoutError() OVERRIDE; |
| 49 virtual void OnAutocheckoutSuccess() OVERRIDE; |
| 50 virtual DialogType GetDialogType() const OVERRIDE; |
| 51 |
| 52 // JNI: |
| 53 void DialogCancel(JNIEnv* env, jobject obj); |
| 54 void DialogContinue(JNIEnv* env, |
| 55 jobject obj, |
| 56 jobject full_wallet, |
| 57 jboolean last_used_choice_is_autofill, |
| 58 jstring last_used_account_name, |
| 59 jstring last_used_billing, |
| 60 jstring last_used_shipping, |
| 61 jstring last_used_credit_card); |
| 62 static bool RegisterAutofillDialogTabManagerDelegateAndroid(JNIEnv* env); |
| 63 |
| 64 private: |
| 65 AutofillDialogTabManagerDelegateAndroid( |
| 66 content::WebContents* contents, |
| 67 const FormData& form_structure, |
| 68 const GURL& source_url, |
| 69 const DialogType dialog_type, |
| 70 const base::Callback<void(const FormStructure*, |
| 71 const std::string&)>& callback); |
| 72 |
| 73 const AutofillMetrics& GetMetricLogger() const { |
| 74 return metric_logger_; |
| 75 } |
| 76 |
| 77 bool RequestingCreditCardInfo() const; |
| 78 bool TransmissionWillBeSecure() const; |
| 79 |
| 80 void SetAutocheckoutState(AutocheckoutState autocheckout_state); |
| 81 |
| 82 // The |profile| for |contents_|. |
| 83 Profile* const profile_; |
| 84 |
| 85 // The WebContents where the Autocomplete/Checkout action originated. |
| 86 content::WebContents* const contents_; |
| 87 |
| 88 // For logging UMA metrics. |
| 89 const AutofillMetrics metric_logger_; |
| 90 base::Time dialog_shown_timestamp_; |
| 91 AutofillMetrics::DialogInitialUserStateMetric initial_user_state_; |
| 92 |
| 93 // The time that Autocheckout started running. Reset on error. While this is |
| 94 // a valid time, |AutocheckoutIsRunning()| will return true. |
| 95 base::Time autocheckout_started_timestamp_; |
| 96 |
| 97 // Whether this is an Autocheckout or a requestAutocomplete dialog. |
| 98 const DialogType dialog_type_; |
| 99 |
| 100 FormStructure form_structure_; |
| 101 |
| 102 // Whether the URL visible to the user when this dialog was requested to be |
| 103 // invoked is the same as |source_url_|. |
| 104 bool invoked_from_same_origin_; |
| 105 |
| 106 // The URL of the invoking site. |
| 107 GURL source_url_; |
| 108 |
| 109 // The callback via which we return the collected data and, if Online Wallet |
| 110 // was used, the Google transaction id. |
| 111 base::Callback<void(const FormStructure*, const std::string&)> callback_; |
| 112 |
| 113 // Whether |form_structure_| has asked for any details that would indicate |
| 114 // we should show a shipping section. |
| 115 bool cares_about_shipping_; |
| 116 |
| 117 base::WeakPtrFactory<AutofillDialogTabManagerDelegateAndroid> |
| 118 weak_ptr_factory_; |
| 119 |
| 120 // The current state of the Autocheckout flow. |
| 121 AutocheckoutState autocheckout_state_; |
| 122 |
| 123 // Whether the latency to display to the UI was logged to UMA yet. |
| 124 bool was_ui_latency_logged_; |
| 125 |
| 126 // The corresponding java object. |
| 127 base::android::ScopedJavaGlobalRef<jobject> java_object_; |
| 128 |
| 129 DISALLOW_COPY_AND_ASSIGN(AutofillDialogTabManagerDelegateAndroid); |
| 130 }; |
| 131 |
| 132 } // namespace autofill |
| 133 |
| 134 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_TAB_MANAGER_DELEGA
TE_ANDROID_H_ |
OLD | NEW |