| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | |
| 17 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 18 #include "components/omnibox/browser/omnibox_view.h" | 17 #include "components/omnibox/browser/omnibox_view.h" |
| 19 #include "components/security_state/security_state_model.h" | 18 #include "components/security_state/security_state_model.h" |
| 20 #include "ui/base/window_open_disposition.h" | 19 #include "ui/base/window_open_disposition.h" |
| 21 #include "ui/gfx/range/range.h" | 20 #include "ui/gfx/range/range.h" |
| 22 #include "ui/views/controls/textfield/textfield.h" | 21 #include "ui/views/controls/textfield/textfield.h" |
| 23 #include "ui/views/controls/textfield/textfield_controller.h" | 22 #include "ui/views/controls/textfield/textfield_controller.h" |
| 24 | 23 |
| 25 #if defined(OS_CHROMEOS) | 24 #if defined(OS_CHROMEOS) |
| 26 #include "ui/base/ime/chromeos/input_method_manager.h" | 25 #include "ui/base/ime/chromeos/input_method_manager.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // Paste text from the clipboard into the omnibox. | 117 // Paste text from the clipboard into the omnibox. |
| 119 // Textfields implementation of Paste() pastes the contents of the clipboard | 118 // Textfields implementation of Paste() pastes the contents of the clipboard |
| 120 // as is. We want to strip whitespace and other things (see GetClipboardText() | 119 // as is. We want to strip whitespace and other things (see GetClipboardText() |
| 121 // for details). The function invokes OnBefore/AfterPossibleChange() as | 120 // for details). The function invokes OnBefore/AfterPossibleChange() as |
| 122 // necessary. | 121 // necessary. |
| 123 void OnPaste(); | 122 void OnPaste(); |
| 124 | 123 |
| 125 // Handle keyword hint tab-to-search and tabbing through dropdown results. | 124 // Handle keyword hint tab-to-search and tabbing through dropdown results. |
| 126 bool HandleEarlyTabActions(const ui::KeyEvent& event); | 125 bool HandleEarlyTabActions(const ui::KeyEvent& event); |
| 127 | 126 |
| 128 // Handles a request to change the value of this text field from software | |
| 129 // using an accessibility API (typically automation software, screen readers | |
| 130 // don't normally use this). If |clear_first| is true, this replaces all text | |
| 131 // with the |new_value|. Otherwise this inserts |new_value| at the cursor | |
| 132 // position, replacing any selected text. The cursor is placed at the end of | |
| 133 // |new_value|. | |
| 134 void AccessibilitySetValue(const base::string16& new_value, bool clear_first); | |
| 135 | |
| 136 // Updates |security_level_| based on the toolbar model's current value. | 127 // Updates |security_level_| based on the toolbar model's current value. |
| 137 void UpdateSecurityLevel(); | 128 void UpdateSecurityLevel(); |
| 138 | 129 |
| 139 // OmniboxView: | 130 // OmniboxView: |
| 140 void SetWindowTextAndCaretPos(const base::string16& text, | 131 void SetWindowTextAndCaretPos(const base::string16& text, |
| 141 size_t caret_pos, | 132 size_t caret_pos, |
| 142 bool update_popup, | 133 bool update_popup, |
| 143 bool notify_text_changed) override; | 134 bool notify_text_changed) override; |
| 144 bool IsSelectAll() const override; | 135 bool IsSelectAll() const override; |
| 145 bool DeleteAtEndPressed() override; | 136 bool DeleteAtEndPressed() override; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 168 // views::Textfield: | 159 // views::Textfield: |
| 169 bool IsItemForCommandIdDynamic(int command_id) const override; | 160 bool IsItemForCommandIdDynamic(int command_id) const override; |
| 170 base::string16 GetLabelForCommandId(int command_id) const override; | 161 base::string16 GetLabelForCommandId(int command_id) const override; |
| 171 const char* GetClassName() const override; | 162 const char* GetClassName() const override; |
| 172 bool OnMousePressed(const ui::MouseEvent& event) override; | 163 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 173 bool OnMouseDragged(const ui::MouseEvent& event) override; | 164 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 174 void OnMouseReleased(const ui::MouseEvent& event) override; | 165 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 175 void OnGestureEvent(ui::GestureEvent* event) override; | 166 void OnGestureEvent(ui::GestureEvent* event) override; |
| 176 void AboutToRequestFocusFromTabTraversal(bool reverse) override; | 167 void AboutToRequestFocusFromTabTraversal(bool reverse) override; |
| 177 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; | 168 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; |
| 178 void GetAccessibleState(ui::AXViewState* state) override; | 169 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 170 void HandleAccessibleAction(const ui::AXActionData& action_data) override; |
| 179 void OnFocus() override; | 171 void OnFocus() override; |
| 180 void OnBlur() override; | 172 void OnBlur() override; |
| 181 bool IsCommandIdEnabled(int command_id) const override; | 173 bool IsCommandIdEnabled(int command_id) const override; |
| 182 base::string16 GetSelectionClipboardText() const override; | 174 base::string16 GetSelectionClipboardText() const override; |
| 183 void DoInsertChar(base::char16 ch) override; | 175 void DoInsertChar(base::char16 ch) override; |
| 184 bool IsTextEditCommandEnabled(ui::TextEditCommand command) const override; | 176 bool IsTextEditCommandEnabled(ui::TextEditCommand command) const override; |
| 185 void ExecuteTextEditCommand(ui::TextEditCommand command) override; | 177 void ExecuteTextEditCommand(ui::TextEditCommand command) override; |
| 186 | 178 |
| 187 // chromeos::input_method::InputMethodManager::CandidateWindowObserver: | 179 // chromeos::input_method::InputMethodManager::CandidateWindowObserver: |
| 188 #if defined(OS_CHROMEOS) | 180 #if defined(OS_CHROMEOS) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 240 |
| 249 // Indicates if we want to select all text in the omnibox when we get a | 241 // Indicates if we want to select all text in the omnibox when we get a |
| 250 // GESTURE_TAP. We want to select all only when the textfield is not in focus | 242 // GESTURE_TAP. We want to select all only when the textfield is not in focus |
| 251 // and gets a tap. So we use this variable to remember focus state before tap. | 243 // and gets a tap. So we use this variable to remember focus state before tap. |
| 252 bool select_all_on_gesture_tap_; | 244 bool select_all_on_gesture_tap_; |
| 253 | 245 |
| 254 // The time of the first character insert operation that has not yet been | 246 // The time of the first character insert operation that has not yet been |
| 255 // painted. Used to measure omnibox responsiveness with a histogram. | 247 // painted. Used to measure omnibox responsiveness with a histogram. |
| 256 base::TimeTicks insert_char_time_; | 248 base::TimeTicks insert_char_time_; |
| 257 | 249 |
| 258 // Used to bind callback functions to this object. | |
| 259 base::WeakPtrFactory<OmniboxViewViews> weak_ptr_factory_; | |
| 260 | |
| 261 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); | 250 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); |
| 262 }; | 251 }; |
| 263 | 252 |
| 264 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 253 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
| OLD | NEW |