Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Side by Side Diff: chrome/browser/ui/autofill/autofill_popup_controller_impl.h

Issue 15769018: [Autofill] Determine Popup RTLness from page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android compile Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/i18n/rtl.h"
9 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
10 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
11 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" 12 #include "chrome/browser/ui/autofill/autofill_popup_controller.h"
12 #include "content/public/browser/keyboard_listener.h" 13 #include "content/public/browser/keyboard_listener.h"
13 #include "ui/gfx/font.h" 14 #include "ui/gfx/font.h"
14 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
15 #include "ui/gfx/rect_f.h" 16 #include "ui/gfx/rect_f.h"
16 17
17 namespace gfx { 18 namespace gfx {
18 class Display; 19 class Display;
(...skipping 14 matching lines...) Expand all
33 class AutofillPopupControllerImpl : public AutofillPopupController, 34 class AutofillPopupControllerImpl : public AutofillPopupController,
34 public content::KeyboardListener { 35 public content::KeyboardListener {
35 public: 36 public:
36 // Creates a new |AutofillPopupControllerImpl|, or reuses |previous| if 37 // Creates a new |AutofillPopupControllerImpl|, or reuses |previous| if
37 // the construction arguments are the same. |previous| may be invalidated by 38 // the construction arguments are the same. |previous| may be invalidated by
38 // this call. 39 // this call.
39 static base::WeakPtr<AutofillPopupControllerImpl> GetOrCreate( 40 static base::WeakPtr<AutofillPopupControllerImpl> GetOrCreate(
40 base::WeakPtr<AutofillPopupControllerImpl> previous, 41 base::WeakPtr<AutofillPopupControllerImpl> previous,
41 base::WeakPtr<AutofillPopupDelegate> delegate, 42 base::WeakPtr<AutofillPopupDelegate> delegate,
42 gfx::NativeView container_view, 43 gfx::NativeView container_view,
43 const gfx::RectF& element_bounds); 44 const gfx::RectF& element_bounds,
45 base::i18n::TextDirection text_direction);
44 46
45 // Shows the popup, or updates the existing popup with the given values. 47 // Shows the popup, or updates the existing popup with the given values.
46 void Show(const std::vector<string16>& names, 48 void Show(const std::vector<string16>& names,
47 const std::vector<string16>& subtexts, 49 const std::vector<string16>& subtexts,
48 const std::vector<string16>& icons, 50 const std::vector<string16>& icons,
49 const std::vector<int>& identifiers); 51 const std::vector<int>& identifiers);
50 52
51 // Hides the popup and destroys the controller. This also invalidates 53 // Hides the popup and destroys the controller. This also invalidates
52 // |delegate_|. 54 // |delegate_|.
53 virtual void Hide() OVERRIDE; 55 virtual void Hide() OVERRIDE;
54 56
55 // Invoked when the view was destroyed by by someone other than this class. 57 // Invoked when the view was destroyed by by someone other than this class.
56 virtual void ViewDestroyed() OVERRIDE; 58 virtual void ViewDestroyed() OVERRIDE;
57 59
58 // KeyboardListener implementation. 60 // KeyboardListener implementation.
59 virtual bool HandleKeyPressEvent( 61 virtual bool HandleKeyPressEvent(
60 const content::NativeWebKeyboardEvent& event) OVERRIDE; 62 const content::NativeWebKeyboardEvent& event) OVERRIDE;
61 63
62 protected: 64 protected:
63 FRIEND_TEST_ALL_PREFIXES(AutofillExternalDelegateBrowserTest, 65 FRIEND_TEST_ALL_PREFIXES(AutofillExternalDelegateBrowserTest,
64 CloseWidgetAndNoLeaking); 66 CloseWidgetAndNoLeaking);
65 FRIEND_TEST_ALL_PREFIXES(AutofillPopupControllerUnitTest, 67 FRIEND_TEST_ALL_PREFIXES(AutofillPopupControllerUnitTest,
66 ProperlyResetController); 68 ProperlyResetController);
67 69
68 AutofillPopupControllerImpl(base::WeakPtr<AutofillPopupDelegate> delegate, 70 AutofillPopupControllerImpl(base::WeakPtr<AutofillPopupDelegate> delegate,
69 gfx::NativeView container_view, 71 gfx::NativeView container_view,
70 const gfx::RectF& element_bounds); 72 const gfx::RectF& element_bounds,
73 base::i18n::TextDirection text_direction);
71 virtual ~AutofillPopupControllerImpl(); 74 virtual ~AutofillPopupControllerImpl();
72 75
73 // AutofillPopupController implementation. 76 // AutofillPopupController implementation.
74 virtual void UpdateBoundsAndRedrawPopup() OVERRIDE; 77 virtual void UpdateBoundsAndRedrawPopup() OVERRIDE;
75 virtual void MouseHovered(int x, int y) OVERRIDE; 78 virtual void MouseHovered(int x, int y) OVERRIDE;
76 virtual void MouseClicked(int x, int y) OVERRIDE; 79 virtual void MouseClicked(int x, int y) OVERRIDE;
77 virtual void MouseExitedPopup() OVERRIDE; 80 virtual void MouseExitedPopup() OVERRIDE;
78 virtual void AcceptSuggestion(size_t index) OVERRIDE; 81 virtual void AcceptSuggestion(size_t index) OVERRIDE;
79 virtual int GetIconResourceID(const string16& resource_name) OVERRIDE; 82 virtual int GetIconResourceID(const string16& resource_name) OVERRIDE;
80 virtual bool CanDelete(size_t index) const OVERRIDE; 83 virtual bool CanDelete(size_t index) const OVERRIDE;
81 virtual gfx::Rect GetRowBounds(size_t index) OVERRIDE; 84 virtual gfx::Rect GetRowBounds(size_t index) OVERRIDE;
82 virtual void SetPopupBounds(const gfx::Rect& bounds) OVERRIDE; 85 virtual void SetPopupBounds(const gfx::Rect& bounds) OVERRIDE;
83 virtual const gfx::Rect& popup_bounds() const OVERRIDE; 86 virtual const gfx::Rect& popup_bounds() const OVERRIDE;
84 virtual gfx::NativeView container_view() const OVERRIDE; 87 virtual gfx::NativeView container_view() const OVERRIDE;
85 virtual const gfx::RectF& element_bounds() const OVERRIDE; 88 virtual const gfx::RectF& element_bounds() const OVERRIDE;
89 virtual bool IsRTL() const OVERRIDE;
86 90
87 virtual const std::vector<string16>& names() const OVERRIDE; 91 virtual const std::vector<string16>& names() const OVERRIDE;
88 virtual const std::vector<string16>& subtexts() const OVERRIDE; 92 virtual const std::vector<string16>& subtexts() const OVERRIDE;
89 virtual const std::vector<string16>& icons() const OVERRIDE; 93 virtual const std::vector<string16>& icons() const OVERRIDE;
90 virtual const std::vector<int>& identifiers() const OVERRIDE; 94 virtual const std::vector<int>& identifiers() const OVERRIDE;
91 #if !defined(OS_ANDROID) 95 #if !defined(OS_ANDROID)
92 virtual const gfx::Font& GetNameFontForRow(size_t index) const OVERRIDE; 96 virtual const gfx::Font& GetNameFontForRow(size_t index) const OVERRIDE;
93 virtual const gfx::Font& subtext_font() const OVERRIDE; 97 virtual const gfx::Font& subtext_font() const OVERRIDE;
94 #endif 98 #endif
95 virtual int selected_line() const OVERRIDE; 99 virtual int selected_line() const OVERRIDE;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 base::WeakPtr<AutofillPopupDelegate> delegate_; 188 base::WeakPtr<AutofillPopupDelegate> delegate_;
185 gfx::NativeView container_view_; // Weak reference. 189 gfx::NativeView container_view_; // Weak reference.
186 190
187 // The bounds of the text element that is the focus of the Autofill. 191 // The bounds of the text element that is the focus of the Autofill.
188 // These coordinates are in screen space. 192 // These coordinates are in screen space.
189 const gfx::RectF element_bounds_; 193 const gfx::RectF element_bounds_;
190 194
191 // The bounds of the Autofill popup. 195 // The bounds of the Autofill popup.
192 gfx::Rect popup_bounds_; 196 gfx::Rect popup_bounds_;
193 197
198 // The text direction of the popup.
199 base::i18n::TextDirection text_direction_;
200
194 // The current Autofill query values. 201 // The current Autofill query values.
195 std::vector<string16> names_; 202 std::vector<string16> names_;
196 std::vector<string16> subtexts_; 203 std::vector<string16> subtexts_;
197 std::vector<string16> icons_; 204 std::vector<string16> icons_;
198 std::vector<int> identifiers_; 205 std::vector<int> identifiers_;
199 206
200 // Since names_ can be elided to ensure that it fits on the screen, we need to 207 // Since names_ can be elided to ensure that it fits on the screen, we need to
201 // keep an unelided copy of the names to be able to pass to the delegate. 208 // keep an unelided copy of the names to be able to pass to the delegate.
202 std::vector<string16> full_names_; 209 std::vector<string16> full_names_;
203 210
204 #if !defined(OS_ANDROID) 211 #if !defined(OS_ANDROID)
205 // The fonts for the popup text. 212 // The fonts for the popup text.
206 gfx::Font name_font_; 213 gfx::Font name_font_;
207 gfx::Font subtext_font_; 214 gfx::Font subtext_font_;
208 gfx::Font warning_font_; 215 gfx::Font warning_font_;
209 #endif 216 #endif
210 217
211 // The line that is currently selected by the user. 218 // The line that is currently selected by the user.
212 // |kNoSelection| indicates that no line is currently selected. 219 // |kNoSelection| indicates that no line is currently selected.
213 int selected_line_; 220 int selected_line_;
214 221
215 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_; 222 base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_;
216 }; 223 };
217 224
218 } // namespace autofill 225 } // namespace autofill
219 226
220 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_ 227 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_CONTROLLER_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_popup_controller.h ('k') | chrome/browser/ui/autofill/autofill_popup_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698