Chromium Code Reviews| Index: chrome/browser/ui/views/autofill/autofill_external_delegate_views.cc |
| diff --git a/chrome/browser/ui/views/autofill/autofill_external_delegate_views.cc b/chrome/browser/ui/views/autofill/autofill_external_delegate_views.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d1cb483ff2131e726b84694d158bf17711d3e2fe |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/autofill/autofill_external_delegate_views.cc |
| @@ -0,0 +1,67 @@ |
| +// 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_external_delegate_views.h" |
| + |
| +#include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h" |
| + |
| +AutofillExternalDelegate* AutofillExternalDelegate::Create( |
| + TabContents* tab_contents, |
| + AutofillManager* autofill_manager) { |
| + return new AutofillExternalDelegateViews(tab_contents, |
| + autofill_manager); |
|
Ilya Sherman
2012/08/14 05:12:09
nit: This looks like it fits on the previous line.
csharp
2012/08/14 19:06:13
Done.
|
| +} |
| + |
| +AutofillExternalDelegateViews::AutofillExternalDelegateViews( |
| + TabContents* tab_contents, |
| + AutofillManager* autofill_manager) |
| + : AutofillExternalDelegate(tab_contents, autofill_manager), |
| + web_contents_(tab_contents->web_contents()) { |
| +} |
| + |
| +AutofillExternalDelegateViews::~AutofillExternalDelegateViews() { |
| +} |
| + |
| +void AutofillExternalDelegateViews::HideAutofillPopupInternal() { |
| + if (!view_.get()) |
| + return; |
| + |
| + view_->Hide(); |
| + |
|
Ilya Sherman
2012/08/14 05:12:09
Optional nit: I would omit this blank line, but up
csharp
2012/08/14 19:06:13
Done.
|
| + view_.reset(); |
| +} |
| + |
| +void AutofillExternalDelegateViews::OnQueryPlatformSpecific( |
| + int query_id, |
| + const webkit::forms::FormData& form, |
| + const webkit::forms::FormField& field, |
| + const gfx::Rect& bounds) { |
| + CreateViewIfNeeded(); |
| + |
|
Ilya Sherman
2012/08/14 05:12:09
nit: Ditto
csharp
2012/08/14 19:06:13
Done.
|
| + view_->set_element_bounds(bounds); |
| +} |
| + |
| +void AutofillExternalDelegateViews::ApplyAutofillSuggestions( |
| + const std::vector<string16>& autofill_values, |
| + const std::vector<string16>& autofill_labels, |
| + const std::vector<string16>& autofill_icons, |
| + const std::vector<int>& autofill_unique_ids) { |
| + CreateViewIfNeeded(); |
| + |
| + view_->Show(autofill_values, |
| + autofill_labels, |
| + autofill_icons, |
| + autofill_unique_ids); |
| +} |
| + |
| +void AutofillExternalDelegateViews::SetBounds(const gfx::Rect& bounds) { |
| + view_->SetBoundsRect(bounds); |
| +} |
| + |
| +void AutofillExternalDelegateViews::CreateViewIfNeeded() { |
| + if (view_.get()) |
|
Ilya Sherman
2012/08/14 05:12:09
Optional nit: This method would be slightly shorte
csharp
2012/08/14 19:06:13
Done.
|
| + return; |
| + |
| + view_.reset(new AutofillPopupViewViews(web_contents_, this)); |
| +} |