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" |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 13 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
14 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 14 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
15 #include "components/autofill/core/browser/autofill_manager_delegate.h" | 15 #include "components/autofill/core/browser/autofill_client.h" |
16 | 16 |
17 class Profile; | 17 class Profile; |
18 | 18 |
19 namespace autofill { | 19 namespace autofill { |
20 | 20 |
21 // This class defines the form-filling host and JNI glue for the Java-side | 21 // This class defines the form-filling host and JNI glue for the Java-side |
22 // implementation of the requestAutocomplete dialog. | 22 // implementation of the requestAutocomplete dialog. |
23 class AutofillDialogControllerAndroid : public AutofillDialogController { | 23 class AutofillDialogControllerAndroid : public AutofillDialogController { |
24 public: | 24 public: |
25 // Creates an instance of the AutofillDialogControllerAndroid. | 25 // Creates an instance of the AutofillDialogControllerAndroid. |
26 static base::WeakPtr<AutofillDialogController> Create( | 26 static base::WeakPtr<AutofillDialogController> Create( |
27 content::WebContents* contents, | 27 content::WebContents* contents, |
28 const FormData& form_structure, | 28 const FormData& form_structure, |
29 const GURL& source_url, | 29 const GURL& source_url, |
30 const AutofillManagerDelegate::ResultCallback& callback); | 30 const AutofillClient::ResultCallback& callback); |
31 | 31 |
32 virtual ~AutofillDialogControllerAndroid(); | 32 virtual ~AutofillDialogControllerAndroid(); |
33 | 33 |
34 // AutofillDialogController implementation: | 34 // AutofillDialogController implementation: |
35 virtual void Show() OVERRIDE; | 35 virtual void Show() OVERRIDE; |
36 virtual void Hide() OVERRIDE; | 36 virtual void Hide() OVERRIDE; |
37 virtual void TabActivated() OVERRIDE; | 37 virtual void TabActivated() OVERRIDE; |
38 | 38 |
39 // JNI bindings for Java-side AutofillDialogDelegate: | 39 // JNI bindings for Java-side AutofillDialogDelegate: |
40 void DialogCancel(JNIEnv* env, jobject obj); | 40 void DialogCancel(JNIEnv* env, jobject obj); |
41 void DialogContinue(JNIEnv* env, | 41 void DialogContinue(JNIEnv* env, |
42 jobject obj, | 42 jobject obj, |
43 jobject full_wallet, | 43 jobject full_wallet, |
44 jboolean last_used_choice_is_autofill, | 44 jboolean last_used_choice_is_autofill, |
45 jstring last_used_account_name, | 45 jstring last_used_account_name, |
46 jstring last_used_billing, | 46 jstring last_used_billing, |
47 jstring last_used_shipping, | 47 jstring last_used_shipping, |
48 jstring last_used_credit_card); | 48 jstring last_used_credit_card); |
49 | 49 |
50 // Establishes JNI bindings. | 50 // Establishes JNI bindings. |
51 static bool RegisterAutofillDialogControllerAndroid(JNIEnv* env); | 51 static bool RegisterAutofillDialogControllerAndroid(JNIEnv* env); |
52 | 52 |
53 private: | 53 private: |
54 AutofillDialogControllerAndroid( | 54 AutofillDialogControllerAndroid( |
55 content::WebContents* contents, | 55 content::WebContents* contents, |
56 const FormData& form_structure, | 56 const FormData& form_structure, |
57 const GURL& source_url, | 57 const GURL& source_url, |
58 const AutofillManagerDelegate::ResultCallback& callback); | 58 const AutofillClient::ResultCallback& callback); |
59 | 59 |
60 const AutofillMetrics& GetMetricLogger() const { | 60 const AutofillMetrics& GetMetricLogger() const { |
61 return metric_logger_; | 61 return metric_logger_; |
62 } | 62 } |
63 | 63 |
64 // Logs metrics when the dialog is submitted. | 64 // Logs metrics when the dialog is submitted. |
65 void LogOnFinishSubmitMetrics(); | 65 void LogOnFinishSubmitMetrics(); |
66 | 66 |
67 // Logs metrics when the dialog is canceled. | 67 // Logs metrics when the dialog is canceled. |
68 void LogOnCancelMetrics(); | 68 void LogOnCancelMetrics(); |
(...skipping 12 matching lines...) Expand all Loading... |
81 FormStructure form_structure_; | 81 FormStructure form_structure_; |
82 | 82 |
83 // Whether the URL visible to the user when this dialog was requested to be | 83 // Whether the URL visible to the user when this dialog was requested to be |
84 // invoked is the same as |source_url_|. | 84 // invoked is the same as |source_url_|. |
85 bool invoked_from_same_origin_; | 85 bool invoked_from_same_origin_; |
86 | 86 |
87 // The URL of the invoking site. | 87 // The URL of the invoking site. |
88 GURL source_url_; | 88 GURL source_url_; |
89 | 89 |
90 // The callback via which we return the collected data. | 90 // The callback via which we return the collected data. |
91 AutofillManagerDelegate::ResultCallback callback_; | 91 AutofillClient::ResultCallback callback_; |
92 | 92 |
93 // Whether |form_structure_| has asked for any details that would indicate | 93 // Whether |form_structure_| has asked for any details that would indicate |
94 // we should show a shipping section. | 94 // we should show a shipping section. |
95 bool cares_about_shipping_; | 95 bool cares_about_shipping_; |
96 | 96 |
97 base::WeakPtrFactory<AutofillDialogControllerAndroid> | 97 base::WeakPtrFactory<AutofillDialogControllerAndroid> |
98 weak_ptr_factory_; | 98 weak_ptr_factory_; |
99 | 99 |
100 // Whether the latency to display to the UI was logged to UMA yet. | 100 // Whether the latency to display to the UI was logged to UMA yet. |
101 bool was_ui_latency_logged_; | 101 bool was_ui_latency_logged_; |
102 | 102 |
103 // The corresponding java object. | 103 // The corresponding java object. |
104 base::android::ScopedJavaGlobalRef<jobject> java_object_; | 104 base::android::ScopedJavaGlobalRef<jobject> java_object_; |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerAndroid); | 106 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerAndroid); |
107 }; | 107 }; |
108 | 108 |
109 } // namespace autofill | 109 } // namespace autofill |
110 | 110 |
111 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_ANDROID
_H_ | 111 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_ANDROID
_H_ |
OLD | NEW |