| 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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 } | 637 } |
| 638 | 638 |
| 639 // Handle the right-arrow key for LTR text and the left-arrow key for RTL text | 639 // Handle the right-arrow key for LTR text and the left-arrow key for RTL text |
| 640 // if there is an Instant suggestion (gray text) that needs to be committed. | 640 // if there is an Instant suggestion (gray text) that needs to be committed. |
| 641 if (GetCursorPosition() == text().length()) { | 641 if (GetCursorPosition() == text().length()) { |
| 642 base::i18n::TextDirection direction = GetTextDirection(); | 642 base::i18n::TextDirection direction = GetTextDirection(); |
| 643 if ((direction == base::i18n::LEFT_TO_RIGHT && | 643 if ((direction == base::i18n::LEFT_TO_RIGHT && |
| 644 event.key_code() == ui::VKEY_RIGHT) || | 644 event.key_code() == ui::VKEY_RIGHT) || |
| 645 (direction == base::i18n::RIGHT_TO_LEFT && | 645 (direction == base::i18n::RIGHT_TO_LEFT && |
| 646 event.key_code() == ui::VKEY_LEFT)) { | 646 event.key_code() == ui::VKEY_LEFT)) { |
| 647 return model()->CommitSuggestedText(true); | 647 return model()->CommitSuggestedText(); |
| 648 } | 648 } |
| 649 } | 649 } |
| 650 | 650 |
| 651 return false; | 651 return false; |
| 652 } | 652 } |
| 653 | 653 |
| 654 void OmniboxViewViews::OnBeforeUserAction(views::Textfield* sender) { | 654 void OmniboxViewViews::OnBeforeUserAction(views::Textfield* sender) { |
| 655 OnBeforePossibleChange(); | 655 OnBeforePossibleChange(); |
| 656 } | 656 } |
| 657 | 657 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 const string16 text(GetClipboardText()); | 900 const string16 text(GetClipboardText()); |
| 901 if (!text.empty()) { | 901 if (!text.empty()) { |
| 902 // Record this paste, so we can do different behavior. | 902 // Record this paste, so we can do different behavior. |
| 903 model()->on_paste(); | 903 model()->on_paste(); |
| 904 // Force a Paste operation to trigger the text_changed code in | 904 // Force a Paste operation to trigger the text_changed code in |
| 905 // OnAfterPossibleChange(), even if identical contents are pasted. | 905 // OnAfterPossibleChange(), even if identical contents are pasted. |
| 906 text_before_change_.clear(); | 906 text_before_change_.clear(); |
| 907 ReplaceSelection(text); | 907 ReplaceSelection(text); |
| 908 } | 908 } |
| 909 } | 909 } |
| OLD | NEW |