| 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 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_VIEWS_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/autofill/autofill_external_delegate.h" |
| 10 |
| 11 class AutofillPopupViewViews; |
| 12 |
| 13 namespace content { |
| 14 class WebContents; |
| 15 } |
| 16 |
| 17 // The View specific implementations of the AutofillExternalDelegate, |
| 18 // handling the communication between the Autofill and Autocomplete |
| 19 // selection and the popup that shows the values. |
| 20 class AutofillExternalDelegateViews : public AutofillExternalDelegate { |
| 21 public: |
| 22 AutofillExternalDelegateViews(TabContents* tab_contents, |
| 23 AutofillManager* autofill_manager); |
| 24 |
| 25 virtual ~AutofillExternalDelegateViews(); |
| 26 |
| 27 // Used by the popup view to indicate it has been destroyed. |
| 28 void InvalidateView(); |
| 29 |
| 30 protected: |
| 31 AutofillPopupViewViews* GetPopup() { return view_; } |
| 32 |
| 33 // AutofillExternalDelegate implementation. |
| 34 // Make protected to allow tests to override. |
| 35 virtual void HideAutofillPopupInternal() OVERRIDE; |
| 36 |
| 37 private: |
| 38 // AutofillExternalDelegate implementation. |
| 39 virtual void OnQueryPlatformSpecific( |
| 40 int query_id, |
| 41 const webkit::forms::FormData& form, |
| 42 const webkit::forms::FormField& field, |
| 43 const gfx::Rect& bounds) OVERRIDE; |
| 44 virtual void ApplyAutofillSuggestions( |
| 45 const std::vector<string16>& autofill_values, |
| 46 const std::vector<string16>& autofill_labels, |
| 47 const std::vector<string16>& autofill_icons, |
| 48 const std::vector<int>& autofill_unique_ids) OVERRIDE; |
| 49 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
| 50 |
| 51 // Create a valid view to display the autofill results if one doesn't |
| 52 // currently exist. |
| 53 void CreateViewIfNeeded(); |
| 54 |
| 55 // We use a raw pointer here because even though we usually create and delete |
| 56 // the view, it is possible for it to get deleted by its parent view (if that |
| 57 // happens we are informed via InvalidateView and we NULL out the pointer). |
| 58 AutofillPopupViewViews* view_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegateViews); |
| 61 }; |
| 62 |
| 63 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_VIEWS_H_ |
| OLD | NEW |