OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_ANDROID_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_ANDROID_H_ |
6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_ANDROID_H_ | 6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // This class defines the form-filling host and JNI glue for the Java-side | 24 // This class defines the form-filling host and JNI glue for the Java-side |
25 // implementation of the requestAutocomplete dialog. | 25 // implementation of the requestAutocomplete dialog. |
26 class AutofillDialogControllerAndroid : public AutofillDialogController { | 26 class AutofillDialogControllerAndroid : public AutofillDialogController { |
27 public: | 27 public: |
28 // Creates an instance of the AutofillDialogControllerAndroid. | 28 // Creates an instance of the AutofillDialogControllerAndroid. |
29 static base::WeakPtr<AutofillDialogController> Create( | 29 static base::WeakPtr<AutofillDialogController> Create( |
30 content::WebContents* contents, | 30 content::WebContents* contents, |
31 const FormData& form_structure, | 31 const FormData& form_structure, |
32 const GURL& source_url, | 32 const GURL& source_url, |
33 const DialogType dialog_type, | |
34 const base::Callback<void(const FormStructure*, | 33 const base::Callback<void(const FormStructure*, |
35 const std::string&)>& callback); | 34 const std::string&)>& callback); |
36 | 35 |
37 // Registers profile preferences for the AutofillDialogControllerAndroid. | 36 // Registers profile preferences for the AutofillDialogControllerAndroid. |
38 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 37 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
39 | 38 |
40 virtual ~AutofillDialogControllerAndroid(); | 39 virtual ~AutofillDialogControllerAndroid(); |
41 | 40 |
42 // AutofillDialogController implementation: | 41 // AutofillDialogController implementation: |
43 virtual void Show() OVERRIDE; | 42 virtual void Show() OVERRIDE; |
44 virtual void Hide() OVERRIDE; | 43 virtual void Hide() OVERRIDE; |
45 virtual void TabActivated() OVERRIDE; | 44 virtual void TabActivated() OVERRIDE; |
46 virtual DialogType GetDialogType() const OVERRIDE; | |
47 | 45 |
48 // JNI bindings for Java-side AutofillDialogDelegate: | 46 // JNI bindings for Java-side AutofillDialogDelegate: |
49 void DialogCancel(JNIEnv* env, jobject obj); | 47 void DialogCancel(JNIEnv* env, jobject obj); |
50 void DialogContinue(JNIEnv* env, | 48 void DialogContinue(JNIEnv* env, |
51 jobject obj, | 49 jobject obj, |
52 jobject full_wallet, | 50 jobject full_wallet, |
53 jboolean last_used_choice_is_autofill, | 51 jboolean last_used_choice_is_autofill, |
54 jstring last_used_account_name, | 52 jstring last_used_account_name, |
55 jstring last_used_billing, | 53 jstring last_used_billing, |
56 jstring last_used_shipping, | 54 jstring last_used_shipping, |
57 jstring last_used_credit_card); | 55 jstring last_used_credit_card); |
58 | 56 |
59 // Establishes JNI bindings. | 57 // Establishes JNI bindings. |
60 static bool RegisterAutofillDialogControllerAndroid(JNIEnv* env); | 58 static bool RegisterAutofillDialogControllerAndroid(JNIEnv* env); |
61 | 59 |
62 private: | 60 private: |
63 AutofillDialogControllerAndroid( | 61 AutofillDialogControllerAndroid( |
64 content::WebContents* contents, | 62 content::WebContents* contents, |
65 const FormData& form_structure, | 63 const FormData& form_structure, |
66 const GURL& source_url, | 64 const GURL& source_url, |
67 const DialogType dialog_type, | |
68 const base::Callback<void(const FormStructure*, | 65 const base::Callback<void(const FormStructure*, |
69 const std::string&)>& callback); | 66 const std::string&)>& callback); |
70 | 67 |
71 const AutofillMetrics& GetMetricLogger() const { | 68 const AutofillMetrics& GetMetricLogger() const { |
72 return metric_logger_; | 69 return metric_logger_; |
73 } | 70 } |
74 | 71 |
75 // Logs metrics when the dialog is submitted. | 72 // Logs metrics when the dialog is submitted. |
76 void LogOnFinishSubmitMetrics(); | 73 void LogOnFinishSubmitMetrics(); |
77 | 74 |
78 // Logs metrics when the dialog is canceled. | 75 // Logs metrics when the dialog is canceled. |
79 void LogOnCancelMetrics(); | 76 void LogOnCancelMetrics(); |
80 | 77 |
81 bool RequestingCreditCardInfo() const; | 78 bool RequestingCreditCardInfo() const; |
82 bool TransmissionWillBeSecure() const; | 79 bool TransmissionWillBeSecure() const; |
83 | 80 |
84 // The |profile| for |contents_|. | 81 // The |profile| for |contents_|. |
85 Profile* const profile_; | 82 Profile* const profile_; |
86 | 83 |
87 // The WebContents where the Autocomplete/Checkout action originated. | 84 // The WebContents where the Autocomplete/Checkout action originated. |
88 content::WebContents* const contents_; | 85 content::WebContents* const contents_; |
89 | 86 |
90 // For logging UMA metrics. | 87 // For logging UMA metrics. |
91 const AutofillMetrics metric_logger_; | 88 const AutofillMetrics metric_logger_; |
92 base::Time dialog_shown_timestamp_; | 89 base::Time dialog_shown_timestamp_; |
93 AutofillMetrics::DialogInitialUserStateMetric initial_user_state_; | 90 AutofillMetrics::DialogInitialUserStateMetric initial_user_state_; |
94 | 91 |
95 // Whether this is an Autocheckout or a requestAutocomplete dialog. | |
96 const DialogType dialog_type_; | |
97 | |
98 FormStructure form_structure_; | 92 FormStructure form_structure_; |
99 | 93 |
100 // Whether the URL visible to the user when this dialog was requested to be | 94 // Whether the URL visible to the user when this dialog was requested to be |
101 // invoked is the same as |source_url_|. | 95 // invoked is the same as |source_url_|. |
102 bool invoked_from_same_origin_; | 96 bool invoked_from_same_origin_; |
103 | 97 |
104 // The URL of the invoking site. | 98 // The URL of the invoking site. |
105 GURL source_url_; | 99 GURL source_url_; |
106 | 100 |
107 // The callback via which we return the collected data and, if Online Wallet | 101 // The callback via which we return the collected data and, if Online Wallet |
(...skipping 12 matching lines...) Expand all Loading... |
120 | 114 |
121 // The corresponding java object. | 115 // The corresponding java object. |
122 base::android::ScopedJavaGlobalRef<jobject> java_object_; | 116 base::android::ScopedJavaGlobalRef<jobject> java_object_; |
123 | 117 |
124 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerAndroid); | 118 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerAndroid); |
125 }; | 119 }; |
126 | 120 |
127 } // namespace autofill | 121 } // namespace autofill |
128 | 122 |
129 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_ANDROID
_H_ | 123 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_ANDROID
_H_ |
OLD | NEW |