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

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

Issue 2007503002: Views: Replace resource ids with ui::TextEditCommand enum for text editing commands in Textfield. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added file deleted during rename. Created 4 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_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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 void SetFocus() override; 97 void SetFocus() override;
98 int GetTextWidth() const override; 98 int GetTextWidth() const override;
99 bool IsImeComposing() const override; 99 bool IsImeComposing() const override;
100 100
101 // views::Textfield: 101 // views::Textfield:
102 gfx::Size GetMinimumSize() const override; 102 gfx::Size GetMinimumSize() const override;
103 void OnPaint(gfx::Canvas* canvas) override; 103 void OnPaint(gfx::Canvas* canvas) override;
104 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 104 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
105 void ExecuteCommand(int command_id, int event_flags) override; 105 void ExecuteCommand(int command_id, int event_flags) override;
106 106
107 protected:
108 // views::Textfield:
109 void ExecuteEditCommand(ui::TextEditCommand command) override;
110
107 private: 111 private:
108 FRIEND_TEST_ALL_PREFIXES(OmniboxViewViewsTest, CloseOmniboxPopupOnTextDrag); 112 FRIEND_TEST_ALL_PREFIXES(OmniboxViewViewsTest, CloseOmniboxPopupOnTextDrag);
109 113
110 // Update the field with |text| and set the selection. 114 // Update the field with |text| and set the selection.
111 void SetTextAndSelectedRange(const base::string16& text, 115 void SetTextAndSelectedRange(const base::string16& text,
112 const gfx::Range& range); 116 const gfx::Range& range);
113 117
114 // Returns the selected text. 118 // Returns the selected text.
115 base::string16 GetSelectedText() const; 119 base::string16 GetSelectedText() const;
116 120
117 // Paste text from the clipboard into the omnibox. 121 // Paste text from the clipboard into the omnibox.
118 // Textfields implementation of Paste() pastes the contents of the clipboard 122 // Textfields implementation of Paste() pastes the contents of the clipboard
119 // as is. We want to strip whitespace and other things (see GetClipboardText() 123 // as is. We want to strip whitespace and other things (see GetClipboardText()
120 // for details). The function invokes OnBefore/AfterPossibleChange() as 124 // for details). The function invokes OnBefore/AfterPossibleChange() as
121 // necessary. 125 // necessary.
122 void OnPaste(); 126 void OnPaste();
123 127
124 // Handle keyword hint tab-to-search and tabbing through dropdown results. 128 // Handle keyword hint tab-to-search and tabbing through dropdown results.
125 bool HandleEarlyTabActions(const ui::KeyEvent& event); 129 bool HandleEarlyTabActions(const ui::KeyEvent& event);
126 130
127 // Handles a request to change the value of this text field from software 131 // Handles a request to change the value of this text field from software
128 // using an accessibility API (typically automation software, screen readers 132 // using an accessibility API (typically automation software, screen readers
129 // don't normally use this). Sets the value and clears the selection. 133 // don't normally use this). Sets the value and clears the selection.
130 void AccessibilitySetValue(const base::string16& new_value); 134 void AccessibilitySetValue(const base::string16& new_value);
131 135
132 // Updates |security_level_| based on the toolbar model's current value. 136 // Updates |security_level_| based on the toolbar model's current value.
133 void UpdateSecurityLevel(); 137 void UpdateSecurityLevel();
134 138
139 // Returns true if the omnibox has specialized behavior for the given
140 // |command|.
141 bool IsEditCommandEnabledInternal(ui::TextEditCommand command) const;
142
135 // OmniboxView: 143 // OmniboxView:
136 void SetWindowTextAndCaretPos(const base::string16& text, 144 void SetWindowTextAndCaretPos(const base::string16& text,
137 size_t caret_pos, 145 size_t caret_pos,
138 bool update_popup, 146 bool update_popup,
139 bool notify_text_changed) override; 147 bool notify_text_changed) override;
140 bool IsSelectAll() const override; 148 bool IsSelectAll() const override;
141 bool DeleteAtEndPressed() override; 149 bool DeleteAtEndPressed() override;
142 void UpdatePopup() override; 150 void UpdatePopup() override;
143 void ApplyCaretVisibility() override; 151 void ApplyCaretVisibility() override;
144 void OnTemporaryTextMaybeChanged(const base::string16& display_text, 152 void OnTemporaryTextMaybeChanged(const base::string16& display_text,
(...skipping 27 matching lines...) Expand all
172 bool OnKeyPressed(const ui::KeyEvent& event) override; 180 bool OnKeyPressed(const ui::KeyEvent& event) override;
173 void OnGestureEvent(ui::GestureEvent* event) override; 181 void OnGestureEvent(ui::GestureEvent* event) override;
174 void AboutToRequestFocusFromTabTraversal(bool reverse) override; 182 void AboutToRequestFocusFromTabTraversal(bool reverse) override;
175 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; 183 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override;
176 void GetAccessibleState(ui::AXViewState* state) override; 184 void GetAccessibleState(ui::AXViewState* state) override;
177 void OnFocus() override; 185 void OnFocus() override;
178 void OnBlur() override; 186 void OnBlur() override;
179 bool IsCommandIdEnabled(int command_id) const override; 187 bool IsCommandIdEnabled(int command_id) const override;
180 base::string16 GetSelectionClipboardText() const override; 188 base::string16 GetSelectionClipboardText() const override;
181 void DoInsertChar(base::char16 ch) override; 189 void DoInsertChar(base::char16 ch) override;
190 bool IsEditCommandEnabled(ui::TextEditCommand command) const override;
182 191
183 // chromeos::input_method::InputMethodManager::CandidateWindowObserver: 192 // chromeos::input_method::InputMethodManager::CandidateWindowObserver:
184 #if defined(OS_CHROMEOS) 193 #if defined(OS_CHROMEOS)
185 void CandidateWindowOpened( 194 void CandidateWindowOpened(
186 chromeos::input_method::InputMethodManager* manager) override; 195 chromeos::input_method::InputMethodManager* manager) override;
187 void CandidateWindowClosed( 196 void CandidateWindowClosed(
188 chromeos::input_method::InputMethodManager* manager) override; 197 chromeos::input_method::InputMethodManager* manager) override;
189 #endif 198 #endif
190 199
191 // views::TextfieldController: 200 // views::TextfieldController:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // painted. Used to measure omnibox responsiveness with a histogram. 261 // painted. Used to measure omnibox responsiveness with a histogram.
253 base::TimeTicks insert_char_time_; 262 base::TimeTicks insert_char_time_;
254 263
255 // Used to bind callback functions to this object. 264 // Used to bind callback functions to this object.
256 base::WeakPtrFactory<OmniboxViewViews> weak_ptr_factory_; 265 base::WeakPtrFactory<OmniboxViewViews> weak_ptr_factory_;
257 266
258 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); 267 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews);
259 }; 268 };
260 269
261 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ 270 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698