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/property_bag.h" | 8 #include "base/property_bag.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
390 !textfield_->HasFocus(); | 390 !textfield_->HasFocus(); |
391 } | 391 } |
392 | 392 |
393 void OmniboxViewViews::HandleMouseDragEvent(const views::MouseEvent& event) { | 393 void OmniboxViewViews::HandleMouseDragEvent(const views::MouseEvent& event) { |
394 select_all_on_mouse_release_ = false; | 394 select_all_on_mouse_release_ = false; |
395 } | 395 } |
396 | 396 |
397 void OmniboxViewViews::HandleMouseReleaseEvent(const views::MouseEvent& event) { | 397 void OmniboxViewViews::HandleMouseReleaseEvent(const views::MouseEvent& event) { |
398 if ((event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && | 398 if ((event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && |
399 select_all_on_mouse_release_) { | 399 select_all_on_mouse_release_) { |
400 textfield_->SelectAll(); | 400 // Select-all in reverse to show the leading omnibox text on mouse release. |
Peter Kasting
2012/07/11 20:49:17
Nit: The Windows comment is:
// Select all in
msw
2012/07/11 21:46:29
Done.
| |
401 SelectAll(true); | |
401 } | 402 } |
402 select_all_on_mouse_release_ = false; | 403 select_all_on_mouse_release_ = false; |
403 } | 404 } |
404 | 405 |
405 void OmniboxViewViews::HandleFocusIn() { | 406 void OmniboxViewViews::HandleFocusIn() { |
406 // TODO(oshima): Get control key state. | 407 // TODO(oshima): Get control key state. |
407 model_->OnSetFocus(false); | 408 model_->OnSetFocus(false); |
408 // Don't call controller_->OnSetFocus as this view has already | 409 // Don't call controller_->OnSetFocus as this view has already |
409 // acquired the focus. | 410 // acquired the focus. |
410 } | 411 } |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
943 const ui::Range& range) { | 944 const ui::Range& range) { |
944 if (text != GetText()) | 945 if (text != GetText()) |
945 textfield_->SetText(text); | 946 textfield_->SetText(text); |
946 textfield_->SelectRange(range); | 947 textfield_->SelectRange(range); |
947 } | 948 } |
948 | 949 |
949 string16 OmniboxViewViews::GetSelectedText() const { | 950 string16 OmniboxViewViews::GetSelectedText() const { |
950 // TODO(oshima): Support instant, IME. | 951 // TODO(oshima): Support instant, IME. |
951 return textfield_->GetSelectedText(); | 952 return textfield_->GetSelectedText(); |
952 } | 953 } |
OLD | NEW |