| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> |
| 10 |
| 9 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 10 #include "base/string16.h" | 12 #include "base/string16.h" |
| 11 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
| 12 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 13 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 14 | 16 |
| 15 namespace content { | 17 namespace content { |
| 16 class WebContents; | 18 class WebContents; |
| 17 } | 19 } |
| 18 | 20 |
| 19 class AutofillPopupView : public content::NotificationObserver { | 21 class AutofillPopupView : public content::NotificationObserver { |
| 20 public: | 22 public: |
| 21 explicit AutofillPopupView(content::WebContents* web_contents); | 23 explicit AutofillPopupView(content::WebContents* web_contents); |
| 22 virtual ~AutofillPopupView(); | 24 virtual ~AutofillPopupView(); |
| 23 | 25 |
| 24 // Hide the popup from view. | 26 // Hide the popup from view. |
| 25 virtual void Hide() = 0; | 27 virtual void Hide() = 0; |
| 26 | 28 |
| 27 // Display the autofill popup and fill it in with the values passed in. | 29 // Display the autofill popup and fill it in with the values passed in. |
| 28 virtual void Show(const std::vector<string16>& autofill_values, | 30 // Platform-independent work. |
| 29 const std::vector<string16>& autofill_labels, | 31 void Show(const std::vector<string16>& autofill_values, |
| 30 const std::vector<string16>& autofill_icons, | 32 const std::vector<string16>& autofill_labels, |
| 31 const std::vector<int>& autofill_unique_ids, | 33 const std::vector<string16>& autofill_icons, |
| 32 int separator_index) = 0; | 34 const std::vector<int>& autofill_unique_ids, |
| 35 int separator_index); |
| 33 | 36 |
| 34 | 37 |
| 35 void set_element_bounds(const gfx::Rect& bounds) { | 38 void set_element_bounds(const gfx::Rect& bounds) { |
| 36 element_bounds_ = bounds; | 39 element_bounds_ = bounds; |
| 37 } | 40 } |
| 38 | 41 |
| 39 const gfx::Rect& element_bounds() { return element_bounds_; } | 42 const gfx::Rect& element_bounds() { return element_bounds_; } |
| 40 | 43 |
| 44 protected: |
| 45 // Display the autofill popup and fill it in with the values passed in. |
| 46 // Platform-dependent work. |
| 47 virtual void ShowInternal() = 0; |
| 48 |
| 49 const std::vector<string16>& autofill_values() const { |
| 50 return autofill_values_; |
| 51 } |
| 52 const std::vector<string16>& autofill_labels() const { |
| 53 return autofill_labels_; |
| 54 } |
| 55 const std::vector<string16>& autofill_icons() const { |
| 56 return autofill_icons_; |
| 57 } |
| 58 const int separator_index() const { return separator_index_; } |
| 59 |
| 41 private: | 60 private: |
| 42 // content::NotificationObserver method override. | 61 // content::NotificationObserver method override. |
| 43 virtual void Observe(int type, | 62 virtual void Observe(int type, |
| 44 const content::NotificationSource& source, | 63 const content::NotificationSource& source, |
| 45 const content::NotificationDetails& details) OVERRIDE; | 64 const content::NotificationDetails& details) OVERRIDE; |
| 46 | 65 |
| 47 // A scoped container for notification registries. | 66 // A scoped container for notification registries. |
| 48 content::NotificationRegistrar registrar_; | 67 content::NotificationRegistrar registrar_; |
| 49 | 68 |
| 50 // The bounds of the text element that is the focus of the Autofill. | 69 // The bounds of the text element that is the focus of the Autofill. |
| 51 gfx::Rect element_bounds_; | 70 gfx::Rect element_bounds_; |
| 71 |
| 72 // The current Autofill query values. |
| 73 std::vector<string16> autofill_values_; |
| 74 std::vector<string16> autofill_labels_; |
| 75 std::vector<string16> autofill_icons_; |
| 76 std::vector<int> autofill_unique_ids_; |
| 77 |
| 78 // The location of the separator index (which separates the returned values |
| 79 // from the Autofill options). |
| 80 int separator_index_; |
| 52 }; | 81 }; |
| 53 | 82 |
| 54 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ | 83 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ |
| OLD | NEW |