From 71572873eb78084971b4d1bdd6560f876dc2fada Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Wed, 27 Oct 2010 17:43:05 +0000 Subject: Lands http://codereview.chromium.org/4154003/show for Timo. BUG=59679 TEST=see bug Review URL: http://codereview.chromium.org/4206001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64096 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/instant/instant_loader.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'chrome/browser/instant') diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 3c561b3..8313453 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -7,6 +7,7 @@ #include #include +#include "app/l10n_util.h" #include "base/command_line.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" @@ -566,8 +567,12 @@ void InstantLoader::Update(TabContents* tab_contents, return; } SendUserInputScript(preview_contents_.get(), user_text_); - if (complete_suggested_text_.size() > user_text_.size() && - !complete_suggested_text_.compare(0, user_text_.size(), user_text_)) { + string16 complete_suggested_text_lower = l10n_util::ToLower( + complete_suggested_text_); + string16 user_text_lower = l10n_util::ToLower(user_text_); + if (complete_suggested_text_lower.size() > user_text_lower.size() && + !complete_suggested_text_lower.compare(0, user_text_lower.size(), + user_text_lower)) { *suggested_text = complete_suggested_text_.substr(user_text_.size()); } } else { @@ -678,8 +683,12 @@ void InstantLoader::SetCompleteSuggestedText( if (complete_suggested_text == complete_suggested_text_) return; - if (user_text_.compare(0, user_text_.size(), complete_suggested_text, - 0, user_text_.size())) { + string16 user_text_lower = l10n_util::ToLower(user_text_); + string16 complete_suggested_text_lower = l10n_util::ToLower( + complete_suggested_text); + if (user_text_lower.compare(0, user_text_lower.size(), + complete_suggested_text_lower, + 0, user_text_lower.size())) { // The user text no longer contains the suggested text, ignore it. complete_suggested_text_.clear(); delegate_->SetSuggestedTextFor(this, string16()); -- cgit v1.1