| OLD | NEW |
| (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_external_delegate_views.h" |
| 6 |
| 7 #include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h" |
| 8 |
| 9 AutofillExternalDelegate* AutofillExternalDelegate::Create( |
| 10 TabContents* tab_contents, |
| 11 AutofillManager* autofill_manager) { |
| 12 return new AutofillExternalDelegateViews(tab_contents, autofill_manager); |
| 13 } |
| 14 |
| 15 AutofillExternalDelegateViews::AutofillExternalDelegateViews( |
| 16 TabContents* tab_contents, |
| 17 AutofillManager* autofill_manager) |
| 18 : AutofillExternalDelegate(tab_contents, autofill_manager), |
| 19 popup_view_(NULL) { |
| 20 } |
| 21 |
| 22 AutofillExternalDelegateViews::~AutofillExternalDelegateViews() { |
| 23 if (popup_view_) |
| 24 popup_view_->Hide(); |
| 25 } |
| 26 |
| 27 void AutofillExternalDelegateViews::InvalidateView() { |
| 28 popup_view_ = NULL; |
| 29 HideAutofillPopup(); |
| 30 } |
| 31 |
| 32 void AutofillExternalDelegateViews::HideAutofillPopupInternal() { |
| 33 if (!popup_view_) |
| 34 return; |
| 35 |
| 36 popup_view_->Hide(); |
| 37 popup_view_ = NULL; |
| 38 } |
| 39 |
| 40 void AutofillExternalDelegateViews::OnQueryPlatformSpecific( |
| 41 int query_id, |
| 42 const webkit::forms::FormData& form, |
| 43 const webkit::forms::FormField& field, |
| 44 const gfx::Rect& bounds) { |
| 45 CreateViewIfNeeded(); |
| 46 popup_view_->set_element_bounds(bounds); |
| 47 } |
| 48 |
| 49 void AutofillExternalDelegateViews::ApplyAutofillSuggestions( |
| 50 const std::vector<string16>& autofill_values, |
| 51 const std::vector<string16>& autofill_labels, |
| 52 const std::vector<string16>& autofill_icons, |
| 53 const std::vector<int>& autofill_unique_ids) { |
| 54 CreateViewIfNeeded(); |
| 55 |
| 56 popup_view_->Show(autofill_values, |
| 57 autofill_labels, |
| 58 autofill_icons, |
| 59 autofill_unique_ids); |
| 60 } |
| 61 |
| 62 void AutofillExternalDelegateViews::SetBounds(const gfx::Rect& bounds) { |
| 63 popup_view_->SetBoundsRect(bounds); |
| 64 } |
| 65 |
| 66 void AutofillExternalDelegateViews::CreateViewIfNeeded() { |
| 67 if (!popup_view_) |
| 68 popup_view_ = new AutofillPopupViewViews(web_contents(), this); |
| 69 } |
| OLD | NEW |