| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 | 689 |
| 690 bool OmniboxViewViews::IsImeShowingPopup() const { | 690 bool OmniboxViewViews::IsImeShowingPopup() const { |
| 691 #if defined(OS_CHROMEOS) | 691 #if defined(OS_CHROMEOS) |
| 692 return ime_candidate_window_open_; | 692 return ime_candidate_window_open_; |
| 693 #else | 693 #else |
| 694 const views::InputMethod* input_method = this->GetInputMethod(); | 694 const views::InputMethod* input_method = this->GetInputMethod(); |
| 695 return input_method && input_method->IsCandidatePopupOpen(); | 695 return input_method && input_method->IsCandidatePopupOpen(); |
| 696 #endif | 696 #endif |
| 697 } | 697 } |
| 698 | 698 |
| 699 void OmniboxViewViews::ShowImeIfNeeded() { |
| 700 GetInputMethod()->ShowImeIfNeeded(); |
| 701 } |
| 702 |
| 699 bool OmniboxViewViews::IsCommandIdEnabled(int command_id) const { | 703 bool OmniboxViewViews::IsCommandIdEnabled(int command_id) const { |
| 700 if (command_id == IDS_APP_PASTE) | 704 if (command_id == IDS_APP_PASTE) |
| 701 return !read_only() && !GetClipboardText().empty(); | 705 return !read_only() && !GetClipboardText().empty(); |
| 702 if (command_id == IDS_PASTE_AND_GO) | 706 if (command_id == IDS_PASTE_AND_GO) |
| 703 return !read_only() && model()->CanPasteAndGo(GetClipboardText()); | 707 return !read_only() && model()->CanPasteAndGo(GetClipboardText()); |
| 704 if (command_id == IDS_SHOW_URL) | 708 if (command_id == IDS_SHOW_URL) |
| 705 return controller()->GetToolbarModel()->WouldReplaceURL(); | 709 return controller()->GetToolbarModel()->WouldReplaceURL(); |
| 706 return Textfield::IsCommandIdEnabled(command_id) || | 710 return Textfield::IsCommandIdEnabled(command_id) || |
| 707 command_updater()->IsCommandEnabled(command_id); | 711 command_updater()->IsCommandEnabled(command_id); |
| 708 } | 712 } |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 const base::string16 text(GetClipboardText()); | 980 const base::string16 text(GetClipboardText()); |
| 977 if (!text.empty()) { | 981 if (!text.empty()) { |
| 978 // Record this paste, so we can do different behavior. | 982 // Record this paste, so we can do different behavior. |
| 979 model()->OnPaste(); | 983 model()->OnPaste(); |
| 980 // Force a Paste operation to trigger the text_changed code in | 984 // Force a Paste operation to trigger the text_changed code in |
| 981 // OnAfterPossibleChange(), even if identical contents are pasted. | 985 // OnAfterPossibleChange(), even if identical contents are pasted. |
| 982 text_before_change_.clear(); | 986 text_before_change_.clear(); |
| 983 InsertOrReplaceText(text); | 987 InsertOrReplaceText(text); |
| 984 } | 988 } |
| 985 } | 989 } |
| OLD | NEW |