| 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 SetTextAndSelectedRange(text, range); | 487 SetTextAndSelectedRange(text, range); |
| 488 | 488 |
| 489 if (update_popup) | 489 if (update_popup) |
| 490 UpdatePopup(); | 490 UpdatePopup(); |
| 491 | 491 |
| 492 if (notify_text_changed) | 492 if (notify_text_changed) |
| 493 TextChanged(); | 493 TextChanged(); |
| 494 } | 494 } |
| 495 | 495 |
| 496 void OmniboxViewViews::SetForcedQuery() { | 496 void OmniboxViewViews::SetForcedQuery() { |
| 497 const string16 current_text(text()); | 497 const base::string16 current_text(text()); |
| 498 const size_t start = current_text.find_first_not_of(kWhitespaceUTF16); | 498 const size_t start = current_text.find_first_not_of(base::kWhitespaceUTF16); |
| 499 if (start == string16::npos || (current_text[start] != '?')) | 499 if (start == string16::npos || (current_text[start] != '?')) |
| 500 OmniboxView::SetUserText(ASCIIToUTF16("?")); | 500 OmniboxView::SetUserText(ASCIIToUTF16("?")); |
| 501 else | 501 else |
| 502 SelectRange(gfx::Range(current_text.size(), start + 1)); | 502 SelectRange(gfx::Range(current_text.size(), start + 1)); |
| 503 } | 503 } |
| 504 | 504 |
| 505 bool OmniboxViewViews::IsSelectAll() const { | 505 bool OmniboxViewViews::IsSelectAll() const { |
| 506 // TODO(oshima): IME support. | 506 // TODO(oshima): IME support. |
| 507 return text() == GetSelectedText(); | 507 return text() == GetSelectedText(); |
| 508 } | 508 } |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 const string16 text(GetClipboardText()); | 970 const string16 text(GetClipboardText()); |
| 971 if (!text.empty()) { | 971 if (!text.empty()) { |
| 972 // Record this paste, so we can do different behavior. | 972 // Record this paste, so we can do different behavior. |
| 973 model()->OnPaste(); | 973 model()->OnPaste(); |
| 974 // Force a Paste operation to trigger the text_changed code in | 974 // Force a Paste operation to trigger the text_changed code in |
| 975 // OnAfterPossibleChange(), even if identical contents are pasted. | 975 // OnAfterPossibleChange(), even if identical contents are pasted. |
| 976 text_before_change_.clear(); | 976 text_before_change_.clear(); |
| 977 InsertOrReplaceText(text); | 977 InsertOrReplaceText(text); |
| 978 } | 978 } |
| 979 } | 979 } |
| OLD | NEW |