Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: chrome/browser/bookmarks/bookmark_table_model.cc

Issue 115346: Convert Punycode domains to Unicode in URLs shown in the followings:... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/bookmarks/bookmark_table_model.h" 5 #include "chrome/browser/bookmarks/bookmark_table_model.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/time_format.h" 12 #include "base/time_format.h"
13 #include "chrome/browser/bookmarks/bookmark_utils.h" 13 #include "chrome/browser/bookmarks/bookmark_utils.h"
14 #include "chrome/browser/profile.h"
15 #include "chrome/common/pref_names.h"
16 #include "chrome/common/pref_service.h"
14 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
15 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
16 #include "grit/theme_resources.h" 19 #include "grit/theme_resources.h"
20 #include "net/base/net_util.h"
17 21
18 namespace { 22 namespace {
19 23
20 // Number of bookmarks shown in recently bookmarked. 24 // Number of bookmarks shown in recently bookmarked.
21 const int kRecentlyBookmarkedCount = 50; 25 const int kRecentlyBookmarkedCount = 50;
22 26
23 // VectorBackedBookmarkTableModel ---------------------------------------------- 27 // VectorBackedBookmarkTableModel ----------------------------------------------
24 28
25 class VectorBackedBookmarkTableModel : public BookmarkTableModel { 29 class VectorBackedBookmarkTableModel : public BookmarkTableModel {
26 public: 30 public:
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // TODO(xji): Consider adding a special case if the title text is a URL, 304 // TODO(xji): Consider adding a special case if the title text is a URL,
301 // since those should always be displayed LTR. Please refer to 305 // since those should always be displayed LTR. Please refer to
302 // http://crbug.com/6726 for more information. 306 // http://crbug.com/6726 for more information.
303 l10n_util::AdjustStringForLocaleDirection(title, &title); 307 l10n_util::AdjustStringForLocaleDirection(title, &title);
304 return title; 308 return title;
305 } 309 }
306 310
307 case IDS_BOOKMARK_TABLE_URL: { 311 case IDS_BOOKMARK_TABLE_URL: {
308 if (!node->is_url()) 312 if (!node->is_url())
309 return std::wstring(); 313 return std::wstring();
310 std::wstring url_text = UTF8ToWide(node->GetURL().spec()); 314 std::wstring languages = model_ && model_->profile()
315 ? model_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)
316 : std::wstring();
317 std::wstring url_text =
318 net::FormatUrl(node->GetURL(), languages, false, true, NULL, NULL);
311 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) 319 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT)
312 l10n_util::WrapStringWithLTRFormatting(&url_text); 320 l10n_util::WrapStringWithLTRFormatting(&url_text);
313 return url_text; 321 return url_text;
314 } 322 }
315 323
316 case IDS_BOOKMARK_TABLE_PATH: { 324 case IDS_BOOKMARK_TABLE_PATH: {
317 std::wstring path; 325 std::wstring path;
318 BuildPath(node->GetParent(), &path); 326 BuildPath(node->GetParent(), &path);
319 // Force path to have LTR directionality. The whole path (but not every 327 // Force path to have LTR directionality. The whole path (but not every
320 // single path component) is marked with LRE-PDF. For example, 328 // single path component) is marked with LRE-PDF. For example,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 return; 391 return;
384 } 392 }
385 if (node == model()->other_node()) { 393 if (node == model()->other_node()) {
386 *path = l10n_util::GetString(IDS_BOOKMARK_TABLE_OTHER_BOOKMARKS_PATH); 394 *path = l10n_util::GetString(IDS_BOOKMARK_TABLE_OTHER_BOOKMARKS_PATH);
387 return; 395 return;
388 } 396 }
389 BuildPath(node->GetParent(), path); 397 BuildPath(node->GetParent(), path);
390 path->append(l10n_util::GetString(IDS_BOOKMARK_TABLE_PATH_SEPARATOR)); 398 path->append(l10n_util::GetString(IDS_BOOKMARK_TABLE_PATH_SEPARATOR));
391 path->append(node->GetTitle()); 399 path->append(node->GetTitle());
392 } 400 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider.cc ('k') | chrome/browser/net/url_fixer_upper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698