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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
new file mode 100644
index 0000000000000000000000000000000000000000..54912ff988a49e2728bd9f3e985fa7826eec7a0d
--- /dev/null
+++ b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
@@ -0,0 +1,75 @@
+// 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 "autofill_popup_view_views.h"
+
+#include "chrome/browser/ui/views/autofill/autofill_external_delegate_views.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_view.h"
+#include "ui/gfx/canvas.h"
+#include "ui/gfx/rect.h"
+#include "ui/views/widget/widget.h"
+
+namespace {
+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
+} // namespace
+
+AutofillPopupViewViews::AutofillPopupViewViews(
+ content::WebContents* web_contents,
+ AutofillExternalDelegateViews* external_delegate)
+ : AutofillPopupView(web_contents, external_delegate),
+ external_delegate_(external_delegate),
+ web_contents_(web_contents) {
+}
+
+AutofillPopupViewViews::~AutofillPopupViewViews() {
+ external_delegate_->InvalidateView();
+}
+
+void AutofillPopupViewViews::OnPaint(gfx::Canvas* canvas) {
+ // TODO(csharp): Properly draw the popup.
+ canvas->DrawColor(kPopupBackground);
+}
+
+void AutofillPopupViewViews::ShowInternal() {
+ if (!GetWidget()) {
+ // The widget is destroyed by the corresponding NativeWidget, so we use
+ // a weak pointer to hold the reference and don't have to worry about
+ // deletion.
+ views::Widget* widget = new views::Widget;
+ views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
+ params.delegate = this;
+ params.can_activate = false;
+ params.transparent = true;
+ params.parent = web_contents_->GetView()->GetTopLevelNativeWindow();
+ widget->Init(params);
+ widget->SetContentsView(this);
+ widget->Show();
+
+ gfx::Rect client_area;
+ web_contents_->GetContainerBounds(&client_area);
+ widget->SetBounds(client_area);
+ }
+
+ ResizePopup();
+
+ web_contents_->GetRenderViewHost()->AddKeyboardListener(this);
+}
+
+void AutofillPopupViewViews::HideInternal() {
+ GetWidget()->Close();
+ web_contents_->GetRenderViewHost()->RemoveKeyboardListener(this);
+}
+
+void AutofillPopupViewViews::InvalidateRow(size_t row) {
+ // TODO(csharp): invalidate this row.
+}
+
+void AutofillPopupViewViews::ResizePopup() {
+ gfx::Rect popup_bounds = element_bounds();
+ popup_bounds.set_y(popup_bounds.y() + popup_bounds.height());
+
+ SetBoundsRect(popup_bounds);
+}
« 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