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

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc

Issue 10825324: Start of New Autofill UI for Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebasing Created 8 years, 3 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 "autofill_popup_view_views.h"
6
7 #include "chrome/browser/ui/views/autofill/autofill_external_delegate_views.h"
8 #include "content/public/browser/render_view_host.h"
9 #include "content/public/browser/web_contents.h"
10 #include "content/public/browser/web_contents_view.h"
11 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/rect.h"
13 #include "ui/views/widget/widget.h"
14
15 namespace {
16 const SkColor kPopupBackground = SkColorSetARGB(0xFF, 0x00, 0x00, 0x00);
Nico 2013/01/12 00:05:38 This requires a static initializer for what it's w
17 } // namespace
18
19 AutofillPopupViewViews::AutofillPopupViewViews(
20 content::WebContents* web_contents,
21 AutofillExternalDelegateViews* external_delegate)
22 : AutofillPopupView(web_contents, external_delegate),
23 external_delegate_(external_delegate),
24 web_contents_(web_contents) {
25 }
26
27 AutofillPopupViewViews::~AutofillPopupViewViews() {
28 external_delegate_->InvalidateView();
29 }
30
31 void AutofillPopupViewViews::OnPaint(gfx::Canvas* canvas) {
32 // TODO(csharp): Properly draw the popup.
33 canvas->DrawColor(kPopupBackground);
34 }
35
36 void AutofillPopupViewViews::ShowInternal() {
37 if (!GetWidget()) {
38 // The widget is destroyed by the corresponding NativeWidget, so we use
39 // a weak pointer to hold the reference and don't have to worry about
40 // deletion.
41 views::Widget* widget = new views::Widget;
42 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
43 params.delegate = this;
44 params.can_activate = false;
45 params.transparent = true;
46 params.parent = web_contents_->GetView()->GetTopLevelNativeWindow();
47 widget->Init(params);
48 widget->SetContentsView(this);
49 widget->Show();
50
51 gfx::Rect client_area;
52 web_contents_->GetContainerBounds(&client_area);
53 widget->SetBounds(client_area);
54 }
55
56 ResizePopup();
57
58 web_contents_->GetRenderViewHost()->AddKeyboardListener(this);
59 }
60
61 void AutofillPopupViewViews::HideInternal() {
62 GetWidget()->Close();
63 web_contents_->GetRenderViewHost()->RemoveKeyboardListener(this);
64 }
65
66 void AutofillPopupViewViews::InvalidateRow(size_t row) {
67 // TODO(csharp): invalidate this row.
68 }
69
70 void AutofillPopupViewViews::ResizePopup() {
71 gfx::Rect popup_bounds = element_bounds();
72 popup_bounds.set_y(popup_bounds.y() + popup_bounds.height());
73
74 SetBoundsRect(popup_bounds);
75 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_popup_view_views.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698