OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PASSWORD_MANAGER_ACCOUNT_CHOOSER_DIALOG_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_ACCOUNT_CHOOSER_DIALOG_ANDROID_H_ |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_ACCOUNT_CHOOSER_DIALOG_ANDROID_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_ACCOUNT_CHOOSER_DIALOG_ANDROID_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_vector.h" | |
15 #include "chrome/browser/ui/passwords/manage_passwords_state.h" | 14 #include "chrome/browser/ui/passwords/manage_passwords_state.h" |
16 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
17 | 16 |
18 namespace content { | 17 namespace content { |
19 class WebContents; | 18 class WebContents; |
20 } | 19 } |
21 | 20 |
22 namespace password_manager { | 21 namespace password_manager { |
23 struct CredentialInfo; | 22 struct CredentialInfo; |
24 } | 23 } |
25 | 24 |
26 // Native counterpart for the android dialog which allows users to select | 25 // Native counterpart for the android dialog which allows users to select |
27 // credentials which will be passed to the web site in order to log in the user. | 26 // credentials which will be passed to the web site in order to log in the user. |
28 class AccountChooserDialogAndroid : public content::WebContentsObserver { | 27 class AccountChooserDialogAndroid : public content::WebContentsObserver { |
29 public: | 28 public: |
30 AccountChooserDialogAndroid( | 29 AccountChooserDialogAndroid( |
31 content::WebContents* web_contents, | 30 content::WebContents* web_contents, |
32 ScopedVector<autofill::PasswordForm> local_credentials, | 31 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials, |
33 ScopedVector<autofill::PasswordForm> federated_credentials, | 32 std::vector<std::unique_ptr<autofill::PasswordForm>> federation_providers, |
34 const GURL& origin, | 33 const GURL& origin, |
35 const ManagePasswordsState::CredentialsCallback& callback); | 34 const ManagePasswordsState::CredentialsCallback& callback); |
36 | 35 |
37 ~AccountChooserDialogAndroid() override; | 36 ~AccountChooserDialogAndroid() override; |
38 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 37 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
39 | 38 |
40 void ShowDialog(); | 39 void ShowDialog(); |
41 | 40 |
42 // Closes the dialog and propagates that no credentials was chosen. | 41 // Closes the dialog and propagates that no credentials was chosen. |
43 void CancelDialog(JNIEnv* env, | 42 void CancelDialog(JNIEnv* env, |
(...skipping 10 matching lines...) Expand all Loading... |
54 void OnLinkClicked(JNIEnv* env, | 53 void OnLinkClicked(JNIEnv* env, |
55 const base::android::JavaParamRef<jobject>& obj); | 54 const base::android::JavaParamRef<jobject>& obj); |
56 | 55 |
57 // content::WebContentsObserver overrides: | 56 // content::WebContentsObserver overrides: |
58 void WebContentsDestroyed() override; | 57 void WebContentsDestroyed() override; |
59 void WasHidden() override; | 58 void WasHidden() override; |
60 | 59 |
61 private: | 60 private: |
62 void OnDialogCancel(); | 61 void OnDialogCancel(); |
63 | 62 |
64 const std::vector<const autofill::PasswordForm*>& local_credentials_forms() | 63 const std::vector<std::unique_ptr<autofill::PasswordForm>>& |
65 const; | 64 local_credentials_forms() const; |
66 | 65 |
67 const std::vector<const autofill::PasswordForm*>& | 66 const std::vector<std::unique_ptr<autofill::PasswordForm>>& |
68 federated_credentials_forms() const; | 67 federation_providers_forms() const; |
69 | 68 |
70 void ChooseCredential(size_t index, | 69 void ChooseCredential(size_t index, |
71 password_manager::CredentialType type, | 70 password_manager::CredentialType type, |
72 bool sign_button_clicked); | 71 bool sign_button_clicked); |
73 | 72 |
74 content::WebContents* web_contents_; | 73 content::WebContents* web_contents_; |
75 ManagePasswordsState passwords_data_; | 74 ManagePasswordsState passwords_data_; |
76 GURL origin_; | 75 GURL origin_; |
77 base::android::ScopedJavaGlobalRef<jobject> dialog_jobject_; | 76 base::android::ScopedJavaGlobalRef<jobject> dialog_jobject_; |
78 | 77 |
79 DISALLOW_COPY_AND_ASSIGN(AccountChooserDialogAndroid); | 78 DISALLOW_COPY_AND_ASSIGN(AccountChooserDialogAndroid); |
80 }; | 79 }; |
81 | 80 |
82 // Native JNI methods | 81 // Native JNI methods |
83 bool RegisterAccountChooserDialogAndroid(JNIEnv* env); | 82 bool RegisterAccountChooserDialogAndroid(JNIEnv* env); |
84 | 83 |
85 #endif // CHROME_BROWSER_PASSWORD_MANAGER_ACCOUNT_CHOOSER_DIALOG_ANDROID_H_ | 84 #endif // CHROME_BROWSER_PASSWORD_MANAGER_ACCOUNT_CHOOSER_DIALOG_ANDROID_H_ |
OLD | NEW |