| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PASSWORD_GENERATION_POPUP_VIEW_ANDROI
D_H_ | 5 #ifndef CHROME_BROWSER_UI_ANDROID_AUTOFILL_PASSWORD_GENERATION_POPUP_VIEW_ANDROI
D_H_ |
| 6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_PASSWORD_GENERATION_POPUP_VIEW_ANDROI
D_H_ | 6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_PASSWORD_GENERATION_POPUP_VIEW_ANDROI
D_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/ui/autofill/password_generation_popup_view.h" | 13 #include "chrome/browser/ui/autofill/password_generation_popup_view.h" |
| 14 #include "ui/android/view_android.h" |
| 14 | 15 |
| 15 namespace autofill { | 16 namespace autofill { |
| 16 | 17 |
| 17 class PasswordGenerationPopupController; | 18 class PasswordGenerationPopupController; |
| 18 | 19 |
| 19 // The android implementation of the password generation UI. | 20 // The android implementation of the password generation UI. |
| 20 class PasswordGenerationPopupViewAndroid : public PasswordGenerationPopupView { | 21 class PasswordGenerationPopupViewAndroid : public PasswordGenerationPopupView { |
| 21 public: | 22 public: |
| 22 // Builds the UI for the |controller|. | 23 // Builds the UI for the |controller|. |
| 23 explicit PasswordGenerationPopupViewAndroid( | 24 explicit PasswordGenerationPopupViewAndroid( |
| 24 PasswordGenerationPopupController* controller); | 25 PasswordGenerationPopupController* controller); |
| 25 | 26 |
| 26 // Called from JNI when the "saved passwords" link was clicked. | 27 // Called from JNI when the "saved passwords" link was clicked. |
| 27 void SavedPasswordsLinkClicked( | 28 void SavedPasswordsLinkClicked( |
| 28 JNIEnv* env, | 29 JNIEnv* env, |
| 29 const base::android::JavaParamRef<jobject>& obj); | 30 const base::android::JavaParamRef<jobject>& obj); |
| 30 | 31 |
| 31 // Called from JNI when the popup was dismissed. | 32 // Called from JNI when the popup was dismissed. |
| 32 void Dismissed(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 33 void Dismissed(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 34 void DismissedInternal(); |
| 33 | 35 |
| 34 // Called from JNI when the suggested password was selected. | 36 // Called from JNI when the suggested password was selected. |
| 35 void PasswordSelected(JNIEnv* env, | 37 void PasswordSelected(JNIEnv* env, |
| 36 const base::android::JavaParamRef<jobject>& object); | 38 const base::android::JavaParamRef<jobject>& object); |
| 37 | 39 |
| 38 // Registers the popup with JNI. | 40 // Registers the popup with JNI. |
| 39 static bool Register(JNIEnv* env); | 41 static bool Register(JNIEnv* env); |
| 40 | 42 |
| 41 private: | 43 private: |
| 42 // The popup owns itself. | 44 // The popup owns itself. |
| 43 virtual ~PasswordGenerationPopupViewAndroid(); | 45 virtual ~PasswordGenerationPopupViewAndroid(); |
| 44 | 46 |
| 45 // PasswordGenerationPopupView implementation. | 47 // PasswordGenerationPopupView implementation. |
| 46 void Show() override; | 48 void Show() override; |
| 47 void Hide() override; | 49 void Hide() override; |
| 48 gfx::Size GetPreferredSizeOfPasswordView() override; | 50 gfx::Size GetPreferredSizeOfPasswordView() override; |
| 49 void UpdateBoundsAndRedrawPopup() override; | 51 void UpdateBoundsAndRedrawPopup() override; |
| 50 void PasswordSelectionUpdated() override; | 52 void PasswordSelectionUpdated() override; |
| 51 bool IsPointInPasswordBounds(const gfx::Point& point) override; | 53 bool IsPointInPasswordBounds(const gfx::Point& point) override; |
| 52 | 54 |
| 53 // Weak pointer to the controller. | 55 // Weak pointer to the controller. |
| 54 PasswordGenerationPopupController* controller_; | 56 PasswordGenerationPopupController* controller_; |
| 55 | 57 |
| 56 // The corresponding java object. | 58 // The corresponding java object. |
| 57 base::android::ScopedJavaGlobalRef<jobject> java_object_; | 59 base::android::ScopedJavaGlobalRef<jobject> java_object_; |
| 58 | 60 |
| 61 // Popup view to be anchored to the container. |
| 62 ui::ViewAndroid::ScopedAnchorView popup_; |
| 63 |
| 59 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationPopupViewAndroid); | 64 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationPopupViewAndroid); |
| 60 }; | 65 }; |
| 61 | 66 |
| 62 } // namespace autofill | 67 } // namespace autofill |
| 63 | 68 |
| 64 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_PASSWORD_GENERATION_POPUP_VIEW_AND
ROID_H_ | 69 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_PASSWORD_GENERATION_POPUP_VIEW_AND
ROID_H_ |
| OLD | NEW |