Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4243)

Unified Diff: chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h

Issue 13470023: [autofill] First step towards autofill dialog on OSX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added test to execute dialog. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 30%
copy from chrome/browser/ui/android/autofill/autofill_dialog_view_android.h
copy to chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h
index 517e156ff70c1ad6fcc02de179027740211be7eb..d144c7485d79869fafb10590e6589ae55432a5ef 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_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_
+#define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_
-#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,
UserInputAction action) OVERRIDE;
virtual void GetUserInput(DialogSection section,
@@ -41,61 +45,39 @@ 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();
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_;
- // Updates the visibility of the checkbox to save the edited information
- // locally.
- void UpdateSaveLocallyCheckBox();
+ // The controller |this| queries for logic and state.
+ AutofillDialogController* controller_;
+};
- // The controller that drives this view. Weak pointer, always non-NULL.
- AutofillDialogController* const controller_;
+} // autofill
- // The corresponding java object.
- base::android::ScopedJavaGlobalRef<jobject> java_object_;
+@interface AutofillDialogWindowController : NSWindowController
+ <NSWindowDelegate> {
+ @private
+ content::WebContents* webContents_; // weak.
+ autofill::AutofillDialogCocoa* autofillDialog_; // weak.
- DISALLOW_COPY_AND_ASSIGN(AutofillDialogViewAndroid);
-};
+ scoped_nsobject<GTMWidthBasedTweaker> buttonContainer_;
+}
+
+// Designated initializer. The WebContents cannot be NULL.
+- (id)initWithWebContents:(content::WebContents*)webContents
+ autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog;
+
+// Closes the sheet and ends the modal loop. This will also clean up the memory.
+- (IBAction)closeSheet:(id)sender;
-} // namespace autofill
+@end
-#endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_DIALOG_VIEW_ANDROID_H_
+#endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_

Powered by Google App Engine
This is Rietveld 408576698