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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
434 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION); | 434 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION); |
435 } | 435 } |
436 | 436 |
437 std::string OmniboxViewViews::GetClassName() const { | 437 std::string OmniboxViewViews::GetClassName() const { |
438 return kViewClassName; | 438 return kViewClassName; |
439 } | 439 } |
440 | 440 |
441 void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 441 void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
442 if (popup_view_->IsOpen()) | 442 if (popup_view_->IsOpen()) |
443 popup_view_->UpdatePopupAppearance(); | 443 popup_view_->UpdatePopupAppearance(); |
444 | |
445 // Pass the location bar's bounds to the edit model because the OmniboxView | |
446 // does not fill the entire box when gray text is showing. We also pass the | |
447 // parent view's bounds so that the end margin can be calculated. | |
sreeram
2012/11/29 19:22:49
What does "gray text" have to do with this? I thou
melevin
2012/11/30 23:37:09
Yes, that's what we need it for. But we can't use
| |
448 model()->OnOmniboxBoundsChanged(location_bar_view_->GetBoundsInScreen(), | |
449 location_bar_view_->parent()->GetBoundsInScreen()); | |
444 } | 450 } |
445 | 451 |
446 //////////////////////////////////////////////////////////////////////////////// | 452 //////////////////////////////////////////////////////////////////////////////// |
447 // OmniboxViewViews, AutocopmleteEditView implementation: | 453 // OmniboxViewViews, AutocopmleteEditView implementation: |
448 | 454 |
449 void OmniboxViewViews::SaveStateToTab(WebContents* tab) { | 455 void OmniboxViewViews::SaveStateToTab(WebContents* tab) { |
450 DCHECK(tab); | 456 DCHECK(tab); |
451 | 457 |
452 // We don't want to keep the IME status, so force quit the current | 458 // We don't want to keep the IME status, so force quit the current |
453 // session here. It may affect the selection status, so order is | 459 // session here. It may affect the selection status, so order is |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
933 if (!text.empty()) { | 939 if (!text.empty()) { |
934 // Record this paste, so we can do different behavior. | 940 // Record this paste, so we can do different behavior. |
935 model()->on_paste(); | 941 model()->on_paste(); |
936 // Force a Paste operation to trigger the text_changed code in | 942 // Force a Paste operation to trigger the text_changed code in |
937 // OnAfterPossibleChange(), even if identical contents are pasted into the | 943 // OnAfterPossibleChange(), even if identical contents are pasted into the |
938 // text box. | 944 // text box. |
939 text_before_change_.clear(); | 945 text_before_change_.clear(); |
940 textfield_->ReplaceSelection(text); | 946 textfield_->ReplaceSelection(text); |
941 } | 947 } |
942 } | 948 } |
OLD | NEW |