| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 } | 611 } |
| 612 | 612 |
| 613 // Handle the right-arrow key for LTR text and the left-arrow key for RTL text | 613 // Handle the right-arrow key for LTR text and the left-arrow key for RTL text |
| 614 // if there is an Instant suggestion (gray text) that needs to be committed. | 614 // if there is an Instant suggestion (gray text) that needs to be committed. |
| 615 if (GetCursorPosition() == text().length()) { | 615 if (GetCursorPosition() == text().length()) { |
| 616 base::i18n::TextDirection direction = GetTextDirection(); | 616 base::i18n::TextDirection direction = GetTextDirection(); |
| 617 if ((direction == base::i18n::LEFT_TO_RIGHT && | 617 if ((direction == base::i18n::LEFT_TO_RIGHT && |
| 618 event.key_code() == ui::VKEY_RIGHT) || | 618 event.key_code() == ui::VKEY_RIGHT) || |
| 619 (direction == base::i18n::RIGHT_TO_LEFT && | 619 (direction == base::i18n::RIGHT_TO_LEFT && |
| 620 event.key_code() == ui::VKEY_LEFT)) { | 620 event.key_code() == ui::VKEY_LEFT)) { |
| 621 return model()->CommitSuggestedText(true); | 621 return model()->CommitSuggestedText(); |
| 622 } | 622 } |
| 623 } | 623 } |
| 624 | 624 |
| 625 return false; | 625 return false; |
| 626 } | 626 } |
| 627 | 627 |
| 628 void OmniboxViewViews::OnBeforeUserAction(views::Textfield* sender) { | 628 void OmniboxViewViews::OnBeforeUserAction(views::Textfield* sender) { |
| 629 OnBeforePossibleChange(); | 629 OnBeforePossibleChange(); |
| 630 } | 630 } |
| 631 | 631 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 const string16 text(GetClipboardText()); | 874 const string16 text(GetClipboardText()); |
| 875 if (!text.empty()) { | 875 if (!text.empty()) { |
| 876 // Record this paste, so we can do different behavior. | 876 // Record this paste, so we can do different behavior. |
| 877 model()->on_paste(); | 877 model()->on_paste(); |
| 878 // Force a Paste operation to trigger the text_changed code in | 878 // Force a Paste operation to trigger the text_changed code in |
| 879 // OnAfterPossibleChange(), even if identical contents are pasted. | 879 // OnAfterPossibleChange(), even if identical contents are pasted. |
| 880 text_before_change_.clear(); | 880 text_before_change_.clear(); |
| 881 ReplaceSelection(text); | 881 ReplaceSelection(text); |
| 882 } | 882 } |
| 883 } | 883 } |
| OLD | NEW |