| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 if (notify_text_changed) | 428 if (notify_text_changed) |
| 429 TextChanged(); | 429 TextChanged(); |
| 430 } | 430 } |
| 431 | 431 |
| 432 void OmniboxViewViews::SetCaretPos(size_t caret_pos) { | 432 void OmniboxViewViews::SetCaretPos(size_t caret_pos) { |
| 433 SelectRange(gfx::Range(caret_pos, caret_pos)); | 433 SelectRange(gfx::Range(caret_pos, caret_pos)); |
| 434 } | 434 } |
| 435 | 435 |
| 436 bool OmniboxViewViews::IsSelectAll() const { | 436 bool OmniboxViewViews::IsSelectAll() const { |
| 437 // TODO(oshima): IME support. | 437 // TODO(oshima): IME support. |
| 438 return text() == GetSelectedText(); | 438 return !text().empty() && text() == GetSelectedText(); |
| 439 } | 439 } |
| 440 | 440 |
| 441 bool OmniboxViewViews::DeleteAtEndPressed() { | 441 bool OmniboxViewViews::DeleteAtEndPressed() { |
| 442 return delete_at_end_pressed_; | 442 return delete_at_end_pressed_; |
| 443 } | 443 } |
| 444 | 444 |
| 445 void OmniboxViewViews::UpdatePopup() { | 445 void OmniboxViewViews::UpdatePopup() { |
| 446 model()->SetInputInProgress(true); | 446 model()->SetInputInProgress(true); |
| 447 if (!model()->has_focus()) | 447 if (!model()->has_focus()) |
| 448 return; | 448 return; |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 1081 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
| 1082 | 1082 |
| 1083 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); | 1083 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); |
| 1084 | 1084 |
| 1085 // Minor note: We use IDC_ for command id here while the underlying textfield | 1085 // Minor note: We use IDC_ for command id here while the underlying textfield |
| 1086 // is using IDS_ for all its command ids. This is because views cannot depend | 1086 // is using IDS_ for all its command ids. This is because views cannot depend |
| 1087 // on IDC_ for now. | 1087 // on IDC_ for now. |
| 1088 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1088 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
| 1089 IDS_EDIT_SEARCH_ENGINES); | 1089 IDS_EDIT_SEARCH_ENGINES); |
| 1090 } | 1090 } |
| OLD | NEW |