Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_VIEW_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_VIEW_ANDROID_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_ |
|
sail
2013/04/10 02:36:56
UI_VIEWS -> UI_COCOA
groby-ooo-7-16
2013/04/12 03:13:40
Ooops :)
Done.
On 2013/04/10 02:36:56, sail wrote:
| |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include "base/memory/scoped_ptr.h" |
| 9 | |
| 10 #include "base/android/jni_string.h" | |
| 11 #include "base/android/scoped_java_ref.h" | |
| 12 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 9 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
| 13 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 10 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
| 11 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | |
| 12 | |
| 13 namespace content { | |
| 14 class NavigationController; | |
| 15 } | |
| 16 | |
| 17 @class AutofillDialogWindowController; | |
| 18 @class GTMWidthBasedTweaker; | |
| 14 | 19 |
| 15 namespace autofill { | 20 namespace autofill { |
| 16 | 21 |
| 17 // Android implementation of the Autofill dialog that handles the imperative | 22 class AutofillDialogCocoa : public AutofillDialogView, |
| 18 // autocomplete API call. | 23 public ConstrainedWindowMacDelegate { |
| 19 class AutofillDialogViewAndroid : public AutofillDialogView { | |
| 20 public: | 24 public: |
| 21 explicit AutofillDialogViewAndroid(AutofillDialogController* controller); | 25 explicit AutofillDialogCocoa(AutofillDialogController* controller); |
| 22 virtual ~AutofillDialogViewAndroid(); | 26 virtual ~AutofillDialogCocoa(); |
| 23 | 27 |
| 24 // AutofillDialogView implementation: | 28 // AutofillDialogView implementation: |
| 25 virtual void Show() OVERRIDE; | 29 virtual void Show() OVERRIDE; |
| 26 virtual void Hide() OVERRIDE; | 30 virtual void Hide() OVERRIDE; |
| 27 virtual void UpdateNotificationArea() OVERRIDE; | |
| 28 virtual void UpdateAccountChooser() OVERRIDE; | 31 virtual void UpdateAccountChooser() OVERRIDE; |
| 29 virtual void UpdateButtonStrip() OVERRIDE; | 32 virtual void UpdateButtonStrip() OVERRIDE; |
| 33 virtual void UpdateNotificationArea() OVERRIDE; | |
| 30 virtual void UpdateSection(DialogSection section) OVERRIDE; | 34 virtual void UpdateSection(DialogSection section) OVERRIDE; |
| 31 virtual void GetUserInput(DialogSection section, | 35 virtual void GetUserInput(DialogSection section, |
| 32 DetailOutputMap* output) OVERRIDE; | 36 DetailOutputMap* output) OVERRIDE; |
| 33 virtual string16 GetCvc() OVERRIDE; | 37 virtual string16 GetCvc() OVERRIDE; |
| 34 virtual bool UseBillingForShipping() OVERRIDE; | 38 virtual bool UseBillingForShipping() OVERRIDE; |
| 35 virtual bool SaveDetailsInWallet() OVERRIDE; | 39 virtual bool SaveDetailsInWallet() OVERRIDE; |
| 36 virtual bool SaveDetailsLocally() OVERRIDE; | 40 virtual bool SaveDetailsLocally() OVERRIDE; |
| 37 virtual const content::NavigationController* ShowSignIn() OVERRIDE; | 41 virtual const content::NavigationController* ShowSignIn() OVERRIDE; |
| 38 virtual void HideSignIn() OVERRIDE; | 42 virtual void HideSignIn() OVERRIDE; |
| 39 virtual void UpdateProgressBar(double value) OVERRIDE; | 43 virtual void UpdateProgressBar(double value) OVERRIDE; |
| 40 virtual void ModelChanged() OVERRIDE; | 44 virtual void ModelChanged() OVERRIDE; |
| 41 virtual void SubmitForTesting() OVERRIDE; | 45 virtual void SubmitForTesting() OVERRIDE; |
| 42 virtual void CancelForTesting() OVERRIDE; | 46 virtual void CancelForTesting() OVERRIDE; |
| 43 | 47 |
| 44 // Java to C++ calls | 48 // ConstrainedWindowMacDelegate implementation. |
| 45 void ItemSelected(JNIEnv* env, jobject obj, jint section, jint index); | 49 virtual void OnConstrainedWindowClosed( |
| 46 void AccountSelected(JNIEnv* env, jobject obj, jint index); | 50 ConstrainedWindowMac* window) OVERRIDE; |
| 47 void EditingStart(JNIEnv* env, jobject obj, jint section); | |
| 48 jboolean EditingComplete(JNIEnv* env, jobject obj, jint section); | |
| 49 void EditingCancel(JNIEnv* env, jobject obj, jint section); | |
| 50 base::android::ScopedJavaLocalRef<jstring> ValidateField( | |
| 51 JNIEnv* env, jobject obj, jint type, jstring value); | |
| 52 void ValidateSection(JNIEnv* env, jobject obj, jint section); | |
| 53 void DialogSubmit(JNIEnv* env, jobject obj); | |
| 54 void DialogCancel(JNIEnv* env, jobject obj); | |
| 55 base::android::ScopedJavaLocalRef<jstring> GetLabelForSection( | |
| 56 JNIEnv* env, | |
| 57 jobject obj, | |
| 58 jint section); | |
| 59 base::android::ScopedJavaLocalRef<jobjectArray> GetListForField(JNIEnv* env, | |
| 60 jobject obj, | |
| 61 jint field); | |
| 62 void ContinueAutomaticSignin(JNIEnv* env, jobject obj, | |
| 63 jstring account_name, jstring sid, jstring lsid); | |
| 64 base::android::ScopedJavaLocalRef<jobject> GetIconForField( | |
| 65 JNIEnv* env, | |
| 66 jobject obj, | |
| 67 jint field_id, | |
| 68 jstring jinput); | |
| 69 base::android::ScopedJavaLocalRef<jstring> GetPlaceholderForField( | |
| 70 JNIEnv* env, | |
| 71 jobject obj, | |
| 72 jint section, | |
| 73 jint field_id); | |
| 74 | 51 |
| 75 static bool RegisterAutofillDialogViewAndroid(JNIEnv* env); | 52 void PerformClose(); |
|
sail
2013/04/10 02:36:56
new line after
groby-ooo-7-16
2013/04/12 03:13:40
Done.
| |
| 53 private: | |
| 76 | 54 |
| 77 private: | 55 scoped_ptr<ConstrainedWindowMac> constrained_window_; |
| 78 // Returns the list of available user accounts. | 56 scoped_nsobject<AutofillDialogWindowController> sheet_controller_; |
| 79 std::vector<std::string> GetAvailableUserAccounts(); | |
| 80 bool ValidateSection(DialogSection section, | |
| 81 AutofillDialogController::ValidationType type); | |
| 82 | 57 |
| 83 // Starts an automatic sign-in attempt for a given account. | 58 // The controller |this| queries for logic and state. |
| 84 bool StartAutomaticSignIn(const std::string& username); | 59 AutofillDialogController* controller_; |
| 85 | |
| 86 // The controller that drives this view. Weak pointer, always non-NULL. | |
| 87 AutofillDialogController* const controller_; | |
| 88 | |
| 89 // The corresponding java object. | |
| 90 base::android::ScopedJavaGlobalRef<jobject> java_object_; | |
| 91 | |
| 92 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViewAndroid); | |
| 93 }; | 60 }; |
| 94 | 61 |
| 95 } // namespace autofill | 62 } // autofill |
| 96 | 63 |
| 97 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_VIEW_ANDROID_H_ | 64 @interface AutofillDialogWindowController : NSWindowController |
| 65 <NSWindowDelegate> { | |
| 66 @private | |
| 67 content::WebContents* webContents_; // weak. | |
| 68 autofill::AutofillDialogCocoa* autofillDialog_; // weak. | |
| 69 | |
| 70 scoped_nsobject<GTMWidthBasedTweaker> buttonContainer_; | |
| 71 } | |
| 72 | |
| 73 // Designated initializer. The WebContents cannot be NULL. | |
| 74 - (id)initWithWebContents:(content::WebContents*)webContents | |
| 75 autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog; | |
| 76 | |
| 77 // Closes the sheet and ends the modal loop. This will also clean up the memory. | |
| 78 - (IBAction)closeSheet:(id)sender; | |
|
sail
2013/04/10 02:36:56
end line after
sail
2013/04/10 02:37:26
oops, should be "new line after"
groby-ooo-7-16
2013/04/12 03:13:40
Done.
| |
| 79 @end | |
| 80 | |
| 81 #endif | |
|
sail
2013/04/10 02:36:56
// CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALO
groby-ooo-7-16
2013/04/12 03:13:40
Done.
| |
| OLD | NEW |