Chromium Code Reviews| 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. |
|
Ilya Sherman
2012/01/11 23:36:29
nit: "Platform-independent"
csharp
2012/01/12 19:39:11
Done.
| |
| 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. | |
|
Ilya Sherman
2012/01/11 23:36:29
nit: "Platform-dependent"
csharp
2012/01/12 19:39:11
Done.
| |
| 47 virtual void ShowInternal(const std::vector<string16>& autofill_values, | |
| 48 const std::vector<string16>& autofill_labels, | |
| 49 const std::vector<string16>& autofill_icons) = 0; | |
|
Ilya Sherman
2012/01/11 23:36:29
nit: Hmm, since all of these vectors are exposed v
csharp
2012/01/12 19:39:11
I removed passing them in, since they do need to b
| |
| 50 | |
| 51 const std::vector<string16>& autofill_values() { return autofill_values_; } | |
| 52 const std::vector<string16>& autofill_labels() { return autofill_labels_; } | |
| 53 const std::vector<string16>& autofill_icons() { return autofill_icons_; } | |
| 54 const int separator_index() { return separator_index_; } | |
|
Ilya Sherman
2012/01/11 23:36:29
nit: These methods should be marked const. (Ah, c
csharp
2012/01/12 19:39:11
Done.
| |
| 55 | |
| 41 private: | 56 private: |
| 42 // content::NotificationObserver method override. | 57 // content::NotificationObserver method override. |
| 43 virtual void Observe(int type, | 58 virtual void Observe(int type, |
| 44 const content::NotificationSource& source, | 59 const content::NotificationSource& source, |
| 45 const content::NotificationDetails& details) OVERRIDE; | 60 const content::NotificationDetails& details) OVERRIDE; |
| 46 | 61 |
| 47 // A scoped container for notification registries. | 62 // A scoped container for notification registries. |
| 48 content::NotificationRegistrar registrar_; | 63 content::NotificationRegistrar registrar_; |
| 49 | 64 |
| 50 // The bounds of the text element that is the focus of the Autofill. | 65 // The bounds of the text element that is the focus of the Autofill. |
| 51 gfx::Rect element_bounds_; | 66 gfx::Rect element_bounds_; |
| 67 | |
| 68 // The current autofill query values. | |
|
Ilya Sherman
2012/01/11 23:36:29
nit: "autofill" -> "Autofill"
csharp
2012/01/12 19:39:11
Done.
| |
| 69 std::vector<string16> autofill_values_; | |
| 70 std::vector<string16> autofill_labels_; | |
| 71 std::vector<string16> autofill_icons_; | |
| 72 std::vector<int> autofill_unique_ids_; | |
| 73 | |
| 74 // The location of the separator index (which separator the returned values | |
|
Ilya Sherman
2012/01/11 23:36:29
nit: "which separator" -> "which separates"
csharp
2012/01/12 19:39:11
Done.
| |
| 75 // from autofill options). | |
|
Ilya Sherman
2012/01/11 23:36:29
nit: "from autofill options" -> "from the Autofill
csharp
2012/01/12 19:39:11
Done.
| |
| 76 int separator_index_; | |
| 52 }; | 77 }; |
| 53 | 78 |
| 54 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ | 79 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_POPUP_VIEW_H_ |
| OLD | NEW |