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_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Starts an animation that fades in the entire OmniboxView. | 62 // Starts an animation that fades in the entire OmniboxView. |
63 void FadeIn(); | 63 void FadeIn(); |
64 | 64 |
65 // Exposes the RenderText for tests. | 65 // Exposes the RenderText for tests. |
66 #if defined(UNIT_TEST) | 66 #if defined(UNIT_TEST) |
67 gfx::RenderText* GetRenderText() { | 67 gfx::RenderText* GetRenderText() { |
68 return views::Textfield::GetRenderText(); | 68 return views::Textfield::GetRenderText(); |
69 } | 69 } |
70 #endif | 70 #endif |
71 | 71 |
72 // View: | |
73 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; | |
74 | |
75 // OmniboxView: | 72 // OmniboxView: |
76 virtual void SaveStateToTab(content::WebContents* tab) OVERRIDE; | 73 virtual void SaveStateToTab(content::WebContents* tab) OVERRIDE; |
77 virtual void OnTabChanged(const content::WebContents* web_contents) OVERRIDE; | 74 virtual void OnTabChanged(const content::WebContents* web_contents) OVERRIDE; |
78 virtual void Update() OVERRIDE; | 75 virtual void Update() OVERRIDE; |
79 virtual base::string16 GetText() const OVERRIDE; | 76 virtual base::string16 GetText() const OVERRIDE; |
80 virtual void SetUserText(const base::string16& text, | 77 virtual void SetUserText(const base::string16& text, |
81 const base::string16& display_text, | 78 const base::string16& display_text, |
82 bool update_popup) OVERRIDE; | 79 bool update_popup) OVERRIDE; |
83 virtual void SetForcedQuery() OVERRIDE; | 80 virtual void SetForcedQuery() OVERRIDE; |
84 virtual void GetSelectionBounds( | 81 virtual void GetSelectionBounds( |
85 base::string16::size_type* start, | 82 base::string16::size_type* start, |
86 base::string16::size_type* end) const OVERRIDE; | 83 base::string16::size_type* end) const OVERRIDE; |
87 virtual void SelectAll(bool reversed) OVERRIDE; | 84 virtual void SelectAll(bool reversed) OVERRIDE; |
88 virtual void RevertAll() OVERRIDE; | 85 virtual void RevertAll() OVERRIDE; |
89 virtual void SetFocus() OVERRIDE; | 86 virtual void SetFocus() OVERRIDE; |
90 virtual int GetTextWidth() const OVERRIDE; | 87 virtual int GetTextWidth() const OVERRIDE; |
91 virtual bool IsImeComposing() const OVERRIDE; | 88 virtual bool IsImeComposing() const OVERRIDE; |
| 89 |
| 90 // views::Textfield: |
| 91 virtual gfx::Size GetMinimumSize() OVERRIDE; |
| 92 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; |
92 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 93 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; |
93 | 94 |
94 private: | 95 private: |
95 FRIEND_TEST_ALL_PREFIXES(OmniboxViewViewsTest, CloseOmniboxPopupOnTextDrag); | 96 FRIEND_TEST_ALL_PREFIXES(OmniboxViewViewsTest, CloseOmniboxPopupOnTextDrag); |
96 | 97 |
97 // Return the number of characers in the current buffer. | |
98 virtual int GetOmniboxTextLength() const OVERRIDE; | |
99 | |
100 // Try to parse the current text as a URL and colorize the components. | |
101 virtual void EmphasizeURLComponents() OVERRIDE; | |
102 | |
103 // Update the field with |text| and set the selection. | 98 // Update the field with |text| and set the selection. |
104 void SetTextAndSelectedRange(const base::string16& text, | 99 void SetTextAndSelectedRange(const base::string16& text, |
105 const gfx::Range& range); | 100 const gfx::Range& range); |
106 | 101 |
107 // Returns the selected text. | 102 // Returns the selected text. |
108 base::string16 GetSelectedText() const; | 103 base::string16 GetSelectedText() const; |
109 | 104 |
110 // Paste text from the clipboard into the omnibox. | 105 // Paste text from the clipboard into the omnibox. |
111 // Textfields implementation of Paste() pastes the contents of the clipboard | 106 // Textfields implementation of Paste() pastes the contents of the clipboard |
112 // as is. We want to strip whitespace and other things (see GetClipboardText() | 107 // as is. We want to strip whitespace and other things (see GetClipboardText() |
(...skipping 27 matching lines...) Expand all Loading... |
140 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 135 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
141 virtual gfx::NativeView GetRelativeWindowForPopup() const OVERRIDE; | 136 virtual gfx::NativeView GetRelativeWindowForPopup() const OVERRIDE; |
142 virtual void SetGrayTextAutocompletion(const base::string16& input) OVERRIDE; | 137 virtual void SetGrayTextAutocompletion(const base::string16& input) OVERRIDE; |
143 virtual base::string16 GetGrayTextAutocompletion() const OVERRIDE; | 138 virtual base::string16 GetGrayTextAutocompletion() const OVERRIDE; |
144 virtual int GetWidth() const OVERRIDE; | 139 virtual int GetWidth() const OVERRIDE; |
145 virtual bool IsImeShowingPopup() const OVERRIDE; | 140 virtual bool IsImeShowingPopup() const OVERRIDE; |
146 virtual void ShowImeIfNeeded() OVERRIDE; | 141 virtual void ShowImeIfNeeded() OVERRIDE; |
147 virtual void OnMatchOpened(const AutocompleteMatch& match, | 142 virtual void OnMatchOpened(const AutocompleteMatch& match, |
148 Profile* profile, | 143 Profile* profile, |
149 content::WebContents* web_contents) const OVERRIDE; | 144 content::WebContents* web_contents) const OVERRIDE; |
150 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 145 virtual int GetOmniboxTextLength() const OVERRIDE; |
| 146 virtual void EmphasizeURLComponents() OVERRIDE; |
| 147 |
| 148 // views::Textfield: |
| 149 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; |
151 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; | 150 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; |
152 virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; | 151 virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; |
153 | |
154 // views::Textfield: | |
155 virtual const char* GetClassName() const OVERRIDE; | 152 virtual const char* GetClassName() const OVERRIDE; |
156 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | |
157 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 153 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
158 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | 154 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
159 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 155 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
160 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 156 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
161 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; | |
162 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 157 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
163 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; | 158 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; |
164 virtual bool SkipDefaultKeyEventProcessing( | 159 virtual bool SkipDefaultKeyEventProcessing( |
165 const ui::KeyEvent& event) OVERRIDE; | 160 const ui::KeyEvent& event) OVERRIDE; |
166 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 161 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
| 162 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
167 virtual void OnFocus() OVERRIDE; | 163 virtual void OnFocus() OVERRIDE; |
168 virtual void OnBlur() OVERRIDE; | 164 virtual void OnBlur() OVERRIDE; |
| 165 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
169 virtual base::string16 GetSelectionClipboardText() const OVERRIDE; | 166 virtual base::string16 GetSelectionClipboardText() const OVERRIDE; |
170 | 167 |
171 // gfx::AnimationDelegate: | 168 // gfx::AnimationDelegate: |
172 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | 169 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
173 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | 170 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; |
174 | 171 |
175 // chromeos::input_method::InputMethodManager::CandidateWindowObserver: | 172 // chromeos::input_method::InputMethodManager::CandidateWindowObserver: |
176 #if defined(OS_CHROMEOS) | 173 #if defined(OS_CHROMEOS) |
177 virtual void CandidateWindowOpened( | 174 virtual void CandidateWindowOpened( |
178 chromeos::input_method::InputMethodManager* manager) OVERRIDE; | 175 chromeos::input_method::InputMethodManager* manager) OVERRIDE; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // GESTURE_TAP. We want to select all only when the textfield is not in focus | 232 // GESTURE_TAP. We want to select all only when the textfield is not in focus |
236 // and gets a tap. So we use this variable to remember focus state before tap. | 233 // and gets a tap. So we use this variable to remember focus state before tap. |
237 bool select_all_on_gesture_tap_; | 234 bool select_all_on_gesture_tap_; |
238 | 235 |
239 scoped_ptr<gfx::SlideAnimation> fade_in_animation_; | 236 scoped_ptr<gfx::SlideAnimation> fade_in_animation_; |
240 | 237 |
241 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); | 238 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); |
242 }; | 239 }; |
243 | 240 |
244 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 241 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
OLD | NEW |