diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete.cc | 7 | ||||
-rw-r--r-- | chrome/browser/autocomplete/history_url_provider.cc | 6 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_table_model.cc | 10 | ||||
-rw-r--r-- | chrome/browser/net/url_fixer_upper.cc | 7 | ||||
-rw-r--r-- | chrome/browser/tab_contents/navigation_entry.cc | 9 | ||||
-rw-r--r-- | chrome/browser/toolbar_model.cc | 3 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_editor_view.cc | 15 |
7 files changed, 35 insertions, 22 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc index 65f71c4..9720e73 100644 --- a/chrome/browser/autocomplete/autocomplete.cc +++ b/chrome/browser/autocomplete/autocomplete.cc @@ -6,7 +6,6 @@ #include <algorithm> -#include "app/gfx/text_elider.h" #include "app/l10n_util.h" #include "base/basictypes.h" #include "base/string_util.h" @@ -492,9 +491,9 @@ void AutocompleteProvider::UpdateStarredStateOfMatches() { std::wstring AutocompleteProvider::StringForURLDisplay( const GURL& url, bool check_accept_lang) const { - return gfx::GetCleanStringFromUrl(url, (check_accept_lang && profile_) ? - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) : std::wstring(), - NULL, NULL); + std::wstring languages = (check_accept_lang && profile_) ? + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) : std::wstring(); + return net::FormatUrl(url, languages); } // AutocompleteResult --------------------------------------------------------- diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc index 0083bfe..faae195 100644 --- a/chrome/browser/autocomplete/history_url_provider.cc +++ b/chrome/browser/autocomplete/history_url_provider.cc @@ -6,7 +6,6 @@ #include <algorithm> -#include "app/gfx/text_elider.h" #include "base/basictypes.h" #include "base/histogram.h" #include "base/message_loop.h" @@ -832,9 +831,8 @@ AutocompleteMatch HistoryURLProvider::HistoryMatchToACMatch( !!info.visit_count(), AutocompleteMatch::HISTORY_URL); match.destination_url = info.url(); DCHECK(match.destination_url.is_valid()); - match.fill_into_edit = gfx::GetCleanStringFromUrl(info.url(), - match_type == WHAT_YOU_TYPED ? std::wstring() : params->languages, - NULL, NULL); + match.fill_into_edit = net::FormatUrl(info.url(), + match_type == WHAT_YOU_TYPED ? std::wstring() : params->languages); if (!params->input.prevent_inline_autocomplete()) { match.inline_autocomplete_offset = history_match.input_location + params->input.text().length(); diff --git a/chrome/browser/bookmarks/bookmark_table_model.cc b/chrome/browser/bookmarks/bookmark_table_model.cc index 458ad0c..85d4032 100644 --- a/chrome/browser/bookmarks/bookmark_table_model.cc +++ b/chrome/browser/bookmarks/bookmark_table_model.cc @@ -11,10 +11,14 @@ #include "base/string_util.h" #include "base/time_format.h" #include "chrome/browser/bookmarks/bookmark_utils.h" +#include "chrome/browser/profile.h" +#include "chrome/common/pref_names.h" +#include "chrome/common/pref_service.h" #include "googleurl/src/gurl.h" #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "net/base/net_util.h" namespace { @@ -308,7 +312,11 @@ std::wstring BookmarkTableModel::GetText(int row, int column_id) { case IDS_BOOKMARK_TABLE_URL: { if (!node->is_url()) return std::wstring(); - std::wstring url_text = UTF8ToWide(node->GetURL().spec()); + std::wstring languages = model_ && model_->profile() + ? model_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages) + : std::wstring(); + std::wstring url_text = + net::FormatUrl(node->GetURL(), languages, false, true, NULL, NULL); if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) l10n_util::WrapStringWithLTRFormatting(&url_text); return url_text; diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc index 6572183..f2c29ca 100644 --- a/chrome/browser/net/url_fixer_upper.cc +++ b/chrome/browser/net/url_fixer_upper.cc @@ -6,7 +6,6 @@ #include <algorithm> -#include "app/gfx/text_elider.h" #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" @@ -122,8 +121,7 @@ static string FixupPath(const string& text) { // Here, we know the input looks like a file. GURL file_url = net::FilePathToFileURL(FilePath(filename)); if (file_url.is_valid()) { - return WideToUTF8(gfx::GetCleanStringFromUrl(file_url, std::wstring(), - NULL, NULL)); + return WideToUTF8(net::FormatUrl(file_url, std::wstring())); } // Invalid file URL, just return the input. @@ -522,8 +520,7 @@ string URLFixerUpper::FixupRelativeFile(const FilePath& base_dir, if (is_file) { GURL file_url = net::FilePathToFileURL(full_path); if (file_url.is_valid()) - return WideToUTF8(gfx::GetCleanStringFromUrl(file_url, std::wstring(), - NULL, NULL)); + return WideToUTF8(net::FormatUrl(file_url, std::wstring())); // Invalid files fall through to regular processing. } diff --git a/chrome/browser/tab_contents/navigation_entry.cc b/chrome/browser/tab_contents/navigation_entry.cc index 655a998..b2235bc 100644 --- a/chrome/browser/tab_contents/navigation_entry.cc +++ b/chrome/browser/tab_contents/navigation_entry.cc @@ -4,13 +4,13 @@ #include "chrome/browser/tab_contents/navigation_entry.h" -#include "app/gfx/text_elider.h" #include "app/resource_bundle.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/url_constants.h" #include "grit/app_resources.h" +#include "net/base/net_util.h" // Use this to get a new unique ID for a NavigationEntry during construction. // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). @@ -80,11 +80,10 @@ const string16& NavigationEntry::GetTitleForDisplay( prefs::kAcceptLanguages); } if (!display_url_.is_empty()) { - cached_display_title_ = WideToUTF16Hack(gfx::GetCleanStringFromUrl( - display_url_, languages, NULL, NULL)); + cached_display_title_ = WideToUTF16Hack(net::FormatUrl( + display_url_, languages)); } else if (!url_.is_empty()) { - cached_display_title_ = WideToUTF16Hack(gfx::GetCleanStringFromUrl( - url_, languages, NULL, NULL)); + cached_display_title_ = WideToUTF16Hack(net::FormatUrl(url_, languages)); } return cached_display_title_; } diff --git a/chrome/browser/toolbar_model.cc b/chrome/browser/toolbar_model.cc index b091fc8..e2ee68f 100644 --- a/chrome/browser/toolbar_model.cc +++ b/chrome/browser/toolbar_model.cc @@ -4,7 +4,6 @@ #include "chrome/browser/toolbar_model.h" -#include "app/gfx/text_elider.h" #include "app/l10n_util.h" #include "chrome/browser/cert_store.h" #include "chrome/browser/ssl/ssl_error_info.h" @@ -41,7 +40,7 @@ std::wstring ToolbarModel::GetText() { url = entry->display_url(); } } - return gfx::GetCleanStringFromUrl(url, languages, NULL, NULL); + return net::FormatUrl(url, languages); } ToolbarModel::SecurityLevel ToolbarModel::GetSecurityLevel() { diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc index 835ba59..b79ef28 100644 --- a/chrome/browser/views/bookmark_editor_view.cc +++ b/chrome/browser/views/bookmark_editor_view.cc @@ -12,10 +12,13 @@ #include "chrome/browser/history/history.h" #include "chrome/browser/profile.h" #include "chrome/browser/net/url_fixer_upper.h" +#include "chrome/common/pref_names.h" +#include "chrome/common/pref_service.h" #include "googleurl/src/gurl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" +#include "net/base/net_util.h" #include "views/background.h" #include "views/focus/focus_manager.h" #include "views/grid_layout.h" @@ -246,7 +249,17 @@ void BookmarkEditorView::Init() { title_tf_.SetText(node_ ? node_->GetTitle() : std::wstring()); title_tf_.SetController(this); - url_tf_.SetText(node_ ? UTF8ToWide(node_->GetURL().spec()) : std::wstring()); + std::wstring url_text; + if (node_) { + std::wstring languages = profile_ + ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) + : std::wstring(); + // The following URL is user-editable. We specify omit_username_password= + // false and unescape=false to show the original URL except IDN. + url_text = + net::FormatUrl(node_->GetURL(), languages, false, false, NULL, NULL); + } + url_tf_.SetText(url_text); url_tf_.SetController(this); if (show_tree_) { |