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

Unified Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.cc

Issue 11231063: [views] "Hello, world" autofill imperative API dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile Created 8 years, 2 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
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_dialog_views.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/autofill/autofill_dialog_views.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
new file mode 100644
index 0000000000000000000000000000000000000000..173e7cd0a208119c305429bcc5d994913f2f3bf8
--- /dev/null
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
@@ -0,0 +1,88 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/autofill/autofill_dialog_views.h"
+
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
+#include "chrome/browser/ui/views/constrained_window_views.h"
+#include "ui/views/controls/label.h"
+
+// static
+AutofillDialogView* AutofillDialogView::Create(
+ AutofillDialogController* controller) {
+ return new AutofillDialogViews(controller);
+}
+
+AutofillDialogViews::AutofillDialogViews(AutofillDialogController* controller)
+ : controller_(controller),
+ window_(NULL),
+ contents_(NULL) {
+ DCHECK(controller);
+}
+
+AutofillDialogViews::~AutofillDialogViews() {
+ DCHECK(!window_);
+}
+
+void AutofillDialogViews::Show() {
+ InitChildViews();
+
+ // Ownership of |contents_| is handed off by this call. The ConstrainedWindow
+ // will take care of deleting itself after calling DeleteDelegate().
+ window_ = new ConstrainedWindowViews(
+ controller_->web_contents(), this,
+ true, ConstrainedWindowViews::DEFAULT_INSETS);
+}
+
+string16 AutofillDialogViews::GetWindowTitle() const {
+ return controller_->DialogTitle();
+}
+
+void AutofillDialogViews::DeleteDelegate() {
+ window_ = NULL;
+ // |this| belongs to |controller_|.
+ controller_->ViewClosed(AutofillDialogController::AUTOFILL_ACTION_ABORT);
+}
+
+views::Widget* AutofillDialogViews::GetWidget() {
+ return contents_->GetWidget();
+}
+
+const views::Widget* AutofillDialogViews::GetWidget() const {
+ return contents_->GetWidget();
+}
+
+views::View* AutofillDialogViews::GetContentsView() {
+ return contents_;
+}
+
+string16 AutofillDialogViews::GetDialogButtonLabel(ui::DialogButton button)
+ const {
+ return button == ui::DIALOG_BUTTON_OK ?
+ controller_->ConfirmButtonText() : controller_->CancelButtonText();
+}
+
+bool AutofillDialogViews::IsDialogButtonEnabled(ui::DialogButton button) const {
+ return button == ui::DIALOG_BUTTON_OK ?
+ controller_->ConfirmButtonEnabled() : true;
+}
+
+bool AutofillDialogViews::UseChromeStyle() const {
+ return true;
+}
+
+bool AutofillDialogViews::Cancel() {
+ return true;
+}
+
+bool AutofillDialogViews::Accept() {
+ NOTREACHED();
+ return true;
+}
+
+void AutofillDialogViews::InitChildViews() {
+ contents_ = new views::View();
+ contents_->AddChildView(new views::Label(ASCIIToUTF16("Hello, world.")));
+}
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_dialog_views.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698