Chromium Code Reviews| Index: chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h |
| diff --git a/chrome/browser/ui/android/autofill/autofill_dialog_view_android.h b/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h |
| similarity index 31% |
| copy from chrome/browser/ui/android/autofill/autofill_dialog_view_android.h |
| copy to chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h |
| index 17894a495c585d8f46f0b470329a7c96f4eb1446..183ca531f4df276297d1ea052216d66663ffe26c 100644 |
| --- a/chrome/browser/ui/android/autofill/autofill_dialog_view_android.h |
| +++ b/chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h |
| @@ -2,31 +2,35 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_VIEW_ANDROID_H_ |
| -#define CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_VIEW_ANDROID_H_ |
| +#ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_ |
| +#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:
|
| -#include <jni.h> |
| - |
| -#include "base/android/jni_string.h" |
| -#include "base/android/scoped_java_ref.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
| #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
| +#include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
| + |
| +namespace content { |
| + class NavigationController; |
| +} |
| + |
| +@class AutofillDialogWindowController; |
| +@class GTMWidthBasedTweaker; |
| namespace autofill { |
| -// Android implementation of the Autofill dialog that handles the imperative |
| -// autocomplete API call. |
| -class AutofillDialogViewAndroid : public AutofillDialogView { |
| +class AutofillDialogCocoa : public AutofillDialogView, |
| + public ConstrainedWindowMacDelegate { |
| public: |
| - explicit AutofillDialogViewAndroid(AutofillDialogController* controller); |
| - virtual ~AutofillDialogViewAndroid(); |
| + explicit AutofillDialogCocoa(AutofillDialogController* controller); |
| + virtual ~AutofillDialogCocoa(); |
| // AutofillDialogView implementation: |
| virtual void Show() OVERRIDE; |
| virtual void Hide() OVERRIDE; |
| - virtual void UpdateNotificationArea() OVERRIDE; |
| virtual void UpdateAccountChooser() OVERRIDE; |
| virtual void UpdateButtonStrip() OVERRIDE; |
| + virtual void UpdateNotificationArea() OVERRIDE; |
| virtual void UpdateSection(DialogSection section) OVERRIDE; |
| virtual void GetUserInput(DialogSection section, |
| DetailOutputMap* output) OVERRIDE; |
| @@ -41,57 +45,37 @@ class AutofillDialogViewAndroid : public AutofillDialogView { |
| virtual void SubmitForTesting() OVERRIDE; |
| virtual void CancelForTesting() OVERRIDE; |
| - // Java to C++ calls |
| - void ItemSelected(JNIEnv* env, jobject obj, jint section, jint index); |
| - void AccountSelected(JNIEnv* env, jobject obj, jint index); |
| - void EditingStart(JNIEnv* env, jobject obj, jint section); |
| - jboolean EditingComplete(JNIEnv* env, jobject obj, jint section); |
| - void EditingCancel(JNIEnv* env, jobject obj, jint section); |
| - base::android::ScopedJavaLocalRef<jstring> ValidateField( |
| - JNIEnv* env, jobject obj, jint type, jstring value); |
| - void ValidateSection(JNIEnv* env, jobject obj, jint section); |
| - void DialogSubmit(JNIEnv* env, jobject obj); |
| - void DialogCancel(JNIEnv* env, jobject obj); |
| - base::android::ScopedJavaLocalRef<jstring> GetLabelForSection( |
| - JNIEnv* env, |
| - jobject obj, |
| - jint section); |
| - base::android::ScopedJavaLocalRef<jobjectArray> GetListForField(JNIEnv* env, |
| - jobject obj, |
| - jint field); |
| - void ContinueAutomaticSignin(JNIEnv* env, jobject obj, |
| - jstring account_name, jstring sid, jstring lsid); |
| - base::android::ScopedJavaLocalRef<jobject> GetIconForField( |
| - JNIEnv* env, |
| - jobject obj, |
| - jint field_id, |
| - jstring jinput); |
| - base::android::ScopedJavaLocalRef<jstring> GetPlaceholderForField( |
| - JNIEnv* env, |
| - jobject obj, |
| - jint section, |
| - jint field_id); |
| - |
| - static bool RegisterAutofillDialogViewAndroid(JNIEnv* env); |
| + // ConstrainedWindowMacDelegate implementation. |
| + virtual void OnConstrainedWindowClosed( |
| + ConstrainedWindowMac* window) OVERRIDE; |
| + void PerformClose(); |
|
sail
2013/04/10 02:36:56
new line after
groby-ooo-7-16
2013/04/12 03:13:40
Done.
|
| private: |
| - // Returns the list of available user accounts. |
| - std::vector<std::string> GetAvailableUserAccounts(); |
| - bool ValidateSection(DialogSection section, |
| - AutofillDialogController::ValidationType type); |
| - // Starts an automatic sign-in attempt for a given account. |
| - bool StartAutomaticSignIn(const std::string& username); |
| + scoped_ptr<ConstrainedWindowMac> constrained_window_; |
| + scoped_nsobject<AutofillDialogWindowController> sheet_controller_; |
| - // The controller that drives this view. Weak pointer, always non-NULL. |
| - AutofillDialogController* const controller_; |
| + // The controller |this| queries for logic and state. |
| + AutofillDialogController* controller_; |
| +}; |
| - // The corresponding java object. |
| - base::android::ScopedJavaGlobalRef<jobject> java_object_; |
| +} // autofill |
| - DISALLOW_COPY_AND_ASSIGN(AutofillDialogViewAndroid); |
| -}; |
| +@interface AutofillDialogWindowController : NSWindowController |
| + <NSWindowDelegate> { |
| + @private |
| + content::WebContents* webContents_; // weak. |
| + autofill::AutofillDialogCocoa* autofillDialog_; // weak. |
| + |
| + scoped_nsobject<GTMWidthBasedTweaker> buttonContainer_; |
| +} |
| + |
| +// Designated initializer. The WebContents cannot be NULL. |
| +- (id)initWithWebContents:(content::WebContents*)webContents |
| + autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog; |
| -} // namespace autofill |
| +// Closes the sheet and ends the modal loop. This will also clean up the memory. |
| +- (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.
|
| +@end |
| -#endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_VIEW_ANDROID_H_ |
| +#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.
|