Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 11359198: Implement the Instant extended API startMargin, endMargin, and rtl properties and the onmarginchang… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase after r171018 Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION); 435 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION);
436 } 436 }
437 437
438 std::string OmniboxViewViews::GetClassName() const { 438 std::string OmniboxViewViews::GetClassName() const {
439 return kViewClassName; 439 return kViewClassName;
440 } 440 }
441 441
442 void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { 442 void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) {
443 if (popup_view_->IsOpen()) 443 if (popup_view_->IsOpen())
444 popup_view_->UpdatePopupAppearance(); 444 popup_view_->UpdatePopupAppearance();
445
446 // Pass the location bar's bounds to the edit model. The OmniboxView bounds
447 // cannot be used here because the OmniboxView does not fill the entire box
448 // when gray text is showing.
449 model()->OnOmniboxBoundsChanged(location_bar_view_->GetBoundsInScreen());
sky 2012/12/04 23:06:36 The locationbarview might contain a bunch of other
melevin 2012/12/06 23:13:00 Yes, we want the outer bounds of the location box.
445 } 450 }
446 451
447 //////////////////////////////////////////////////////////////////////////////// 452 ////////////////////////////////////////////////////////////////////////////////
448 // OmniboxViewViews, AutocopmleteEditView implementation: 453 // OmniboxViewViews, AutocopmleteEditView implementation:
449 454
450 void OmniboxViewViews::SaveStateToTab(WebContents* tab) { 455 void OmniboxViewViews::SaveStateToTab(WebContents* tab) {
451 DCHECK(tab); 456 DCHECK(tab);
452 457
453 // 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
454 // session here. It may affect the selection status, so order is 459 // session here. It may affect the selection status, so order is
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 679
675 int OmniboxViewViews::TextWidth() const { 680 int OmniboxViewViews::TextWidth() const {
676 // TODO(oshima): add horizontal margin. 681 // TODO(oshima): add horizontal margin.
677 return textfield_->font().GetStringWidth(textfield_->text()); 682 return textfield_->font().GetStringWidth(textfield_->text());
678 } 683 }
679 684
680 bool OmniboxViewViews::IsImeComposing() const { 685 bool OmniboxViewViews::IsImeComposing() const {
681 return false; 686 return false;
682 } 687 }
683 688
689 gfx::Rect OmniboxViewViews::GetContainerBounds() const {
690 return location_bar_view_->parent()->GetBoundsInScreen();
691 }
692
684 int OmniboxViewViews::GetMaxEditWidth(int entry_width) const { 693 int OmniboxViewViews::GetMaxEditWidth(int entry_width) const {
685 return entry_width; 694 return entry_width;
686 } 695 }
687 696
688 views::View* OmniboxViewViews::AddToView(views::View* parent) { 697 views::View* OmniboxViewViews::AddToView(views::View* parent) {
689 parent->AddChildView(this); 698 parent->AddChildView(this);
690 AddChildView(textfield_); 699 AddChildView(textfield_);
691 return this; 700 return this;
692 } 701 }
693 702
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 if (!text.empty()) { 943 if (!text.empty()) {
935 // Record this paste, so we can do different behavior. 944 // Record this paste, so we can do different behavior.
936 model()->on_paste(); 945 model()->on_paste();
937 // Force a Paste operation to trigger the text_changed code in 946 // Force a Paste operation to trigger the text_changed code in
938 // OnAfterPossibleChange(), even if identical contents are pasted into the 947 // OnAfterPossibleChange(), even if identical contents are pasted into the
939 // text box. 948 // text box.
940 text_before_change_.clear(); 949 text_before_change_.clear();
941 textfield_->ReplaceSelection(text); 950 textfield_->ReplaceSelection(text);
942 } 951 }
943 } 952 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698