diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-04 03:30:34 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-04 03:30:34 +0000 |
commit | 49bcfd24022de81f8492f261cd6781803f902026 (patch) | |
tree | 57dd8de0dcc62a395be73205343491fb509ba5f1 /chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc | |
parent | 87ae793de65887136e54170263a8a7fa88102ff0 (diff) | |
download | chromium_src-49bcfd24022de81f8492f261cd6781803f902026.zip chromium_src-49bcfd24022de81f8492f261cd6781803f902026.tar.gz chromium_src-49bcfd24022de81f8492f261cd6781803f902026.tar.bz2 |
GTK/Mac: show security warning on correct part of url.
Where "security warning" means "diagonal red line".
This change just copies the relevant code from Windows; my suspicion is that when the windows code was updated, mac and linux had already copied the old, incorrect code, but the bug didn't become apparent until the security UI was implemented on those platforms.
BUG=26280
TEST=manual
Review URL: http://codereview.chromium.org/668016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40595 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc index a805539..ae241e0 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc @@ -1307,10 +1307,11 @@ void AutocompleteEditViewGtk::EmphasizeURLComponents() { // this input. This can tell us whether an UNKNOWN input string is going to // be treated as a search or a navigation, and is the same method the Paste // And Go system uses. - url_parse::Parsed parts; - std::wstring text = GetText(); - AutocompleteInput::Parse(text, model_->GetDesiredTLD(), &parts, NULL); - bool emphasize = model_->CurrentTextIsURL() && (parts.host.len > 0); + url_parse::Component scheme, host; + std::wstring text(GetText()); + AutocompleteInput::ParseForEmphasizeComponents( + text, model_->GetDesiredTLD(), &scheme, &host); + const bool emphasize = model_->CurrentTextIsURL() && (host.len > 0); // Set the baseline emphasis. GtkTextIter start, end; @@ -1322,10 +1323,10 @@ void AutocompleteEditViewGtk::EmphasizeURLComponents() { // We've found a host name, give it more emphasis. gtk_text_buffer_get_iter_at_line_index(text_buffer_, &start, 0, GetUTF8Offset(text, - parts.host.begin)); + host.begin)); gtk_text_buffer_get_iter_at_line_index(text_buffer_, &end, 0, GetUTF8Offset(text, - parts.host.end())); + host.end())); gtk_text_buffer_apply_tag(text_buffer_, normal_text_tag_, &start, &end); } else { @@ -1334,10 +1335,10 @@ void AutocompleteEditViewGtk::EmphasizeURLComponents() { strikethrough_ = CharRange(); // Emphasize the scheme for security UI display purposes (if necessary). - if (!model_->user_input_in_progress() && parts.scheme.is_nonempty() && + if (!model_->user_input_in_progress() && scheme.is_nonempty() && (scheme_security_level_ != ToolbarModel::NORMAL)) { - CharRange scheme_range = CharRange(GetUTF8Offset(text, parts.scheme.begin), - GetUTF8Offset(text, parts.scheme.end())); + CharRange scheme_range = CharRange(GetUTF8Offset(text, scheme.begin), + GetUTF8Offset(text, scheme.end())); ItersFromCharRange(scheme_range, &start, &end); if (scheme_security_level_ == ToolbarModel::SECURE) { |