Chromium Code Reviews| 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 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 void OmniboxViewViews::OnPaste() { | 382 void OmniboxViewViews::OnPaste() { |
| 383 const base::string16 text(GetClipboardText()); | 383 const base::string16 text(GetClipboardText()); |
| 384 if (!text.empty()) { | 384 if (!text.empty()) { |
| 385 OnBeforePossibleChange(); | 385 OnBeforePossibleChange(); |
| 386 // Record this paste, so we can do different behavior. | 386 // Record this paste, so we can do different behavior. |
| 387 model()->OnPaste(); | 387 model()->OnPaste(); |
| 388 // Force a Paste operation to trigger the text_changed code in | 388 // Force a Paste operation to trigger the text_changed code in |
| 389 // OnAfterPossibleChange(), even if identical contents are pasted. | 389 // OnAfterPossibleChange(), even if identical contents are pasted. |
| 390 state_before_change_.text.clear(); | 390 state_before_change_.text.clear(); |
| 391 InsertOrReplaceText(text); | 391 InsertOrReplaceText(text); |
| 392 // Since InsertOrReplaceText() is used for programmatically updating state, | |
|
msw
2016/10/07 01:47:52
Textfield::InsertOrReplaceText is *only* called he
| |
| 393 // it won't update cursor state, but since OnPaste() is actually triggered | |
| 394 // by a user action, the cursor does need to be updated. | |
| 395 UpdateAfterChange(true, true); | |
| 392 OnAfterPossibleChange(true); | 396 OnAfterPossibleChange(true); |
| 393 } | 397 } |
| 394 } | 398 } |
| 395 | 399 |
| 396 bool OmniboxViewViews::HandleEarlyTabActions(const ui::KeyEvent& event) { | 400 bool OmniboxViewViews::HandleEarlyTabActions(const ui::KeyEvent& event) { |
| 397 // This must run before accelerator handling invokes a focus change on tab. | 401 // This must run before accelerator handling invokes a focus change on tab. |
| 398 // Note the parallel with SkipDefaultKeyEventProcessing above. | 402 // Note the parallel with SkipDefaultKeyEventProcessing above. |
| 399 if (!views::FocusManager::IsTabTraversalKeyEvent(event)) | 403 if (!views::FocusManager::IsTabTraversalKeyEvent(event)) |
| 400 return false; | 404 return false; |
| 401 | 405 |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1076 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 1080 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
| 1077 | 1081 |
| 1078 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); | 1082 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); |
| 1079 | 1083 |
| 1080 // Minor note: We use IDC_ for command id here while the underlying textfield | 1084 // Minor note: We use IDC_ for command id here while the underlying textfield |
| 1081 // is using IDS_ for all its command ids. This is because views cannot depend | 1085 // is using IDS_ for all its command ids. This is because views cannot depend |
| 1082 // on IDC_ for now. | 1086 // on IDC_ for now. |
| 1083 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1087 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
| 1084 IDS_EDIT_SEARCH_ENGINES); | 1088 IDS_EDIT_SEARCH_ENGINES); |
| 1085 } | 1089 } |
| OLD | NEW |