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

Side by Side 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: couple of forgotten nits 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h"
6
7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
9 #include "chrome/browser/ui/views/constrained_window_views.h"
10 #include "ui/views/controls/label.h"
11
12 // static
13 AutofillDialogView* AutofillDialogView::CreateDialog(
14 AutofillDialogController* controller) {
15 return new AutofillDialogViews(controller);
16 }
17
18 AutofillDialogViews::AutofillDialogViews(AutofillDialogController* controller)
19 : controller_(controller),
20 contents_(NULL) {
21 DCHECK(controller);
22 }
23
24 AutofillDialogViews::~AutofillDialogViews() {}
25
26 void AutofillDialogViews::Show() {
27 InitChildViews();
28
29 // Ownership of |contents_| is handed off by this call. |window_| will take
Ilya Sherman 2012/10/23 04:52:29 nit: Please update this comment not to reference |
Evan Stade 2012/10/23 18:48:04 Done.
30 // care of deleting itself after calling DeleteDelegate().
31 new ConstrainedWindowViews(
32 controller_->web_contents(), this,
33 true, ConstrainedWindowViews::DEFAULT_INSETS);
34 }
35
36 string16 AutofillDialogViews::GetWindowTitle() const {
37 return controller_->DialogTitle();
38 }
39
40 void AutofillDialogViews::DeleteDelegate() {
41 // |this| belongs to |controller_|.
42 controller_->ViewClosed(AutofillDialogController::AUTOFILL_ACTION_ABORT);
43 }
44
45 views::Widget* AutofillDialogViews::GetWidget() {
46 return contents_->GetWidget();
47 }
48
49 const views::Widget* AutofillDialogViews::GetWidget() const {
50 return contents_->GetWidget();
51 }
52
53 views::View* AutofillDialogViews::GetContentsView() {
54 return contents_;
55 }
56
57 string16 AutofillDialogViews::GetDialogButtonLabel(ui::DialogButton button)
58 const {
59 return button == ui::DIALOG_BUTTON_OK ?
60 controller_->ConfirmButtonText() : controller_->CancelButtonText();
61 }
62
63 bool AutofillDialogViews::IsDialogButtonEnabled(ui::DialogButton button) const {
64 return button == ui::DIALOG_BUTTON_OK ?
65 controller_->ConfirmButtonEnabled() : true;
66 }
67
68 bool AutofillDialogViews::UseChromeStyle() const {
69 return true;
70 }
71
72 bool AutofillDialogViews::Cancel() {
73 return true;
74 }
75
76 bool AutofillDialogViews::Accept() {
77 NOTREACHED();
78 return true;
79 }
80
81 void AutofillDialogViews::InitChildViews() {
82 contents_ = new views::View();
83 contents_->AddChildView(new views::Label(ASCIIToUTF16("Hello, world.")));
84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698