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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION); | 422 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION); |
423 } | 423 } |
424 | 424 |
425 std::string OmniboxViewViews::GetClassName() const { | 425 std::string OmniboxViewViews::GetClassName() const { |
426 return kViewClassName; | 426 return kViewClassName; |
427 } | 427 } |
428 | 428 |
429 void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 429 void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
430 if (popup_view_->IsOpen()) | 430 if (popup_view_->IsOpen()) |
431 popup_view_->UpdatePopupAppearance(); | 431 popup_view_->UpdatePopupAppearance(); |
| 432 |
| 433 // Pass the location bar's bounds to the edit model because the OmniboxView |
| 434 // does not fill the entire box when gray text is showing. |
| 435 model()->OnOmniboxBoundsChanged(location_bar_view_->GetBoundsInScreen()); |
432 } | 436 } |
433 | 437 |
434 //////////////////////////////////////////////////////////////////////////////// | 438 //////////////////////////////////////////////////////////////////////////////// |
435 // OmniboxViewViews, AutocopmleteEditView implementation: | 439 // OmniboxViewViews, AutocopmleteEditView implementation: |
436 | 440 |
437 void OmniboxViewViews::SaveStateToTab(WebContents* tab) { | 441 void OmniboxViewViews::SaveStateToTab(WebContents* tab) { |
438 DCHECK(tab); | 442 DCHECK(tab); |
439 | 443 |
440 // We don't want to keep the IME status, so force quit the current | 444 // We don't want to keep the IME status, so force quit the current |
441 // session here. It may affect the selection status, so order is | 445 // session here. It may affect the selection status, so order is |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 | 898 |
895 string16 OmniboxViewViews::GetSelectedText() const { | 899 string16 OmniboxViewViews::GetSelectedText() const { |
896 // TODO(oshima): Support instant, IME. | 900 // TODO(oshima): Support instant, IME. |
897 return textfield_->GetSelectedText(); | 901 return textfield_->GetSelectedText(); |
898 } | 902 } |
899 | 903 |
900 void OmniboxViewViews::CopyURL() { | 904 void OmniboxViewViews::CopyURL() { |
901 const string16& text = toolbar_model()->GetText(false); | 905 const string16& text = toolbar_model()->GetText(false); |
902 DoCopy(text, true, toolbar_model()->GetURL(), text); | 906 DoCopy(text, true, toolbar_model()->GetURL(), text); |
903 } | 907 } |
OLD | NEW |