diff options
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc | 19 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_mac.mm | 18 |
2 files changed, 19 insertions, 18 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) { diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm index e3881e0..a78a6b7 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -394,16 +394,16 @@ void AutocompleteEditViewMac::SetText(const std::wstring& display_text) { [as addAttribute:NSParagraphStyleAttributeName value:paragraph_style range:NSMakeRange(0, [as length])]; - url_parse::Parsed parts; - AutocompleteInput::Parse(display_text, model_->GetDesiredTLD(), - &parts, NULL); - const bool emphasize = model_->CurrentTextIsURL() && (parts.host.len > 0); + url_parse::Component scheme, host; + AutocompleteInput::ParseForEmphasizeComponents( + display_text, model_->GetDesiredTLD(), &scheme, &host); + const bool emphasize = model_->CurrentTextIsURL() && (host.len > 0); if (emphasize) { [as addAttribute:NSForegroundColorAttributeName value:BaseTextColor() range:NSMakeRange(0, [as length])]; [as addAttribute:NSForegroundColorAttributeName value:HostTextColor() - range:ComponentToNSRange(parts.host)]; + range:ComponentToNSRange(host)]; } // TODO(shess): GTK has this as a member var, figure out why. @@ -424,7 +424,7 @@ void AutocompleteEditViewMac::SetText(const std::wstring& display_text) { } // 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)) { NSColor* color; if (scheme_security_level == ToolbarModel::SECURE) { @@ -434,10 +434,10 @@ void AutocompleteEditViewMac::SetText(const std::wstring& display_text) { // Add a strikethrough through the scheme. [as addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] - range:ComponentToNSRange(parts.scheme)]; + range:ComponentToNSRange(scheme)]; } [as addAttribute:NSForegroundColorAttributeName value:color - range:ComponentToNSRange(parts.scheme)]; + range:ComponentToNSRange(scheme)]; } [field_ setAttributedStringValue:as]; |