diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-10 22:19:24 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-10 22:19:24 +0000 |
commit | a4db7e9ca2f12badff11a141fedbd9fca5385fe8 (patch) | |
tree | a82138495d41ff425c3b9d9993b7dd4206d91ab2 /chrome/browser/autocomplete/autocomplete_edit.cc | |
parent | 97bcdf233710049c2ae3ade31c97c8eacd450724 (diff) | |
download | chromium_src-a4db7e9ca2f12badff11a141fedbd9fca5385fe8.zip chromium_src-a4db7e9ca2f12badff11a141fedbd9fca5385fe8.tar.gz chromium_src-a4db7e9ca2f12badff11a141fedbd9fca5385fe8.tar.bz2 |
Changes autocomplete to only prefix with http if haven't modified
host.
BUG=43585
TEST=see bug
Review URL: http://codereview.chromium.org/1993006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit.cc')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 04e1935..9060153 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -196,16 +196,17 @@ void AutocompleteEditModel::AdjustTextForCopy(int sel_start, // the text parses as a url with a scheme of http, the user selected the // entire host, and the user hasn't edited the host or manually removed the // scheme. - if (url->SchemeIs(chrome::kHttpScheme)) { + GURL perm_url; + if (GetURLForText(permanent_text_, &perm_url) && + perm_url.SchemeIs(chrome::kHttpScheme) && + url->SchemeIs(chrome::kHttpScheme) && + perm_url.host() == url->host()) { + *write_url = true; + std::wstring http = ASCIIToWide(chrome::kHttpScheme) + ASCIIToWide(chrome::kStandardSchemeSeparator); - std::wstring host = UTF8ToWide(url->host()); - if (text->compare(0, http.length(), http) != 0 && - text->length() >= host.length() && - permanent_text_.compare(0, host.length(), host) == 0) { + if (text->compare(0, http.length(), http) != 0) *text = http + *text; - *write_url = true; - } } } |