| 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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 | 661 |
| 662 int OmniboxViewViews::TextWidth() const { | 662 int OmniboxViewViews::TextWidth() const { |
| 663 // TODO(oshima): add horizontal margin. | 663 // TODO(oshima): add horizontal margin. |
| 664 return textfield_->font().GetStringWidth(textfield_->text()); | 664 return textfield_->font().GetStringWidth(textfield_->text()); |
| 665 } | 665 } |
| 666 | 666 |
| 667 bool OmniboxViewViews::IsImeComposing() const { | 667 bool OmniboxViewViews::IsImeComposing() const { |
| 668 return false; | 668 return false; |
| 669 } | 669 } |
| 670 | 670 |
| 671 gfx::Rect OmniboxViewViews::GetBounds() const { |
| 672 // The location bar's bounds are returned because when gray text is showing, |
| 673 // the OmniboxView does not fill the entire box. |
| 674 return location_bar_view_->GetBoundsInScreen(); |
| 675 } |
| 676 |
| 671 int OmniboxViewViews::GetMaxEditWidth(int entry_width) const { | 677 int OmniboxViewViews::GetMaxEditWidth(int entry_width) const { |
| 672 return entry_width; | 678 return entry_width; |
| 673 } | 679 } |
| 674 | 680 |
| 675 views::View* OmniboxViewViews::AddToView(views::View* parent) { | 681 views::View* OmniboxViewViews::AddToView(views::View* parent) { |
| 676 parent->AddChildView(this); | 682 parent->AddChildView(this); |
| 677 AddChildView(textfield_); | 683 AddChildView(textfield_); |
| 678 return this; | 684 return this; |
| 679 } | 685 } |
| 680 | 686 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 | 900 |
| 895 string16 OmniboxViewViews::GetSelectedText() const { | 901 string16 OmniboxViewViews::GetSelectedText() const { |
| 896 // TODO(oshima): Support instant, IME. | 902 // TODO(oshima): Support instant, IME. |
| 897 return textfield_->GetSelectedText(); | 903 return textfield_->GetSelectedText(); |
| 898 } | 904 } |
| 899 | 905 |
| 900 void OmniboxViewViews::CopyURL() { | 906 void OmniboxViewViews::CopyURL() { |
| 901 const string16& text = toolbar_model()->GetText(false); | 907 const string16& text = toolbar_model()->GetText(false); |
| 902 DoCopy(text, true, toolbar_model()->GetURL(), text); | 908 DoCopy(text, true, toolbar_model()->GetURL(), text); |
| 903 } | 909 } |
| OLD | NEW |