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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.h

Issue 23536075: Fix multiple problems with omnibox text handling across focus changes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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_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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 virtual bool SkipDefaultKeyEventProcessing( 68 virtual bool SkipDefaultKeyEventProcessing(
69 const ui::KeyEvent& event) OVERRIDE; 69 const ui::KeyEvent& event) OVERRIDE;
70 virtual void OnFocus() OVERRIDE; 70 virtual void OnFocus() OVERRIDE;
71 virtual void OnBlur() OVERRIDE; 71 virtual void OnBlur() OVERRIDE;
72 72
73 // OmniboxView: 73 // OmniboxView:
74 virtual void SaveStateToTab(content::WebContents* tab) OVERRIDE; 74 virtual void SaveStateToTab(content::WebContents* tab) OVERRIDE;
75 virtual void OnTabChanged(const content::WebContents* web_contents) OVERRIDE; 75 virtual void OnTabChanged(const content::WebContents* web_contents) OVERRIDE;
76 virtual void Update() OVERRIDE; 76 virtual void Update() OVERRIDE;
77 virtual string16 GetText() const OVERRIDE; 77 virtual string16 GetText() const OVERRIDE;
78 virtual void SetUserText(const string16& text,
79 const string16& display_text,
80 bool update_popup) OVERRIDE;
78 virtual void SetWindowTextAndCaretPos(const string16& text, 81 virtual void SetWindowTextAndCaretPos(const string16& text,
79 size_t caret_pos, 82 size_t caret_pos,
80 bool update_popup, 83 bool update_popup,
81 bool notify_text_changed) OVERRIDE; 84 bool notify_text_changed) OVERRIDE;
82 virtual void SetForcedQuery() OVERRIDE; 85 virtual void SetForcedQuery() OVERRIDE;
83 virtual bool IsSelectAll() const OVERRIDE; 86 virtual bool IsSelectAll() const OVERRIDE;
84 virtual bool DeleteAtEndPressed() OVERRIDE; 87 virtual bool DeleteAtEndPressed() OVERRIDE;
85 virtual void GetSelectionBounds(string16::size_type* start, 88 virtual void GetSelectionBounds(string16::size_type* start,
86 string16::size_type* end) const OVERRIDE; 89 string16::size_type* end) const OVERRIDE;
87 virtual void SelectAll(bool reversed) OVERRIDE; 90 virtual void SelectAll(bool reversed) OVERRIDE;
91 virtual void RevertAll() OVERRIDE;
88 virtual void UpdatePopup() OVERRIDE; 92 virtual void UpdatePopup() OVERRIDE;
89 virtual void SetFocus() OVERRIDE; 93 virtual void SetFocus() OVERRIDE;
90 virtual void ApplyCaretVisibility() OVERRIDE; 94 virtual void ApplyCaretVisibility() OVERRIDE;
91 virtual void OnTemporaryTextMaybeChanged( 95 virtual void OnTemporaryTextMaybeChanged(
92 const string16& display_text, 96 const string16& display_text,
93 bool save_original_selection, 97 bool save_original_selection,
94 bool notify_text_changed) OVERRIDE; 98 bool notify_text_changed) OVERRIDE;
95 virtual bool OnInlineAutocompleteTextMaybeChanged( 99 virtual bool OnInlineAutocompleteTextMaybeChanged(
96 const string16& display_text, size_t user_text_length) OVERRIDE; 100 const string16& display_text, size_t user_text_length) OVERRIDE;
97 virtual void OnRevertTemporaryText() OVERRIDE; 101 virtual void OnRevertTemporaryText() OVERRIDE;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // different presentation (smaller font size). This is used for popups. 167 // different presentation (smaller font size). This is used for popups.
164 bool popup_window_mode_; 168 bool popup_window_mode_;
165 169
166 scoped_ptr<OmniboxPopupView> popup_view_; 170 scoped_ptr<OmniboxPopupView> popup_view_;
167 171
168 ToolbarModel::SecurityLevel security_level_; 172 ToolbarModel::SecurityLevel security_level_;
169 173
170 // Selection persisted across temporary text changes, like popup suggestions. 174 // Selection persisted across temporary text changes, like popup suggestions.
171 gfx::Range saved_temporary_selection_; 175 gfx::Range saved_temporary_selection_;
172 176
177 // Holds the user's selection across focus changes. There is only a saved
178 // selection if this range IsValid().
179 gfx::Range saved_selection_for_focus_change_;
180
173 // Tracking state before and after a possible change. 181 // Tracking state before and after a possible change.
174 string16 text_before_change_; 182 string16 text_before_change_;
175 gfx::Range sel_before_change_; 183 gfx::Range sel_before_change_;
176 bool ime_composing_before_change_; 184 bool ime_composing_before_change_;
177 185
178 // Was the delete key pressed with an empty selection at the end of the edit? 186 // Was the delete key pressed with an empty selection at the end of the edit?
179 bool delete_at_end_pressed_; 187 bool delete_at_end_pressed_;
180 LocationBarView* location_bar_view_; 188 LocationBarView* location_bar_view_;
181 189
182 // True if the IME candidate window is open. When this is true, we want to 190 // True if the IME candidate window is open. When this is true, we want to
183 // avoid showing the popup. So far, the candidate window is detected only 191 // avoid showing the popup. So far, the candidate window is detected only
184 // on Chrome OS. 192 // on Chrome OS.
185 bool ime_candidate_window_open_; 193 bool ime_candidate_window_open_;
186 194
187 // Should we select all the text when we see the mouse button get released? 195 // Should we select all the text when we see the mouse button get released?
188 // We select in response to a click that focuses the omnibox, but we defer 196 // We select in response to a click that focuses the omnibox, but we defer
189 // until release, setting this variable back to false if we saw a drag, to 197 // until release, setting this variable back to false if we saw a drag, to
190 // allow the user to select just a portion of the text. 198 // allow the user to select just a portion of the text.
191 bool select_all_on_mouse_release_; 199 bool select_all_on_mouse_release_;
192 200
193 // Indicates if we want to select all text in the omnibox when we get a 201 // Indicates if we want to select all text in the omnibox when we get a
194 // GESTURE_TAP. We want to select all only when the textfield is not in focus 202 // GESTURE_TAP. We want to select all only when the textfield is not in focus
195 // and gets a tap. So we use this variable to remember focus state before tap. 203 // and gets a tap. So we use this variable to remember focus state before tap.
196 bool select_all_on_gesture_tap_; 204 bool select_all_on_gesture_tap_;
197 205
198 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); 206 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews);
199 }; 207 };
200 208
201 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ 209 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_view_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698