| OLD | NEW |
| 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" | 14 #include "chrome/browser/profile.h" |
| 15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/common/pref_service.h" | 16 #include "chrome/common/pref_service.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 #include "grit/app_resources.h" | 18 #include "grit/app_resources.h" |
| 19 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 20 #include "grit/theme_resources.h" | 20 #include "grit/theme_resources.h" |
| 21 #include "net/base/escape.h" |
| 21 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
| 22 | 23 |
| 23 #if defined(TOOLKIT_VIEWS) | 24 #if defined(TOOLKIT_VIEWS) |
| 24 #include "views/controls/table/table_model_observer.h" | 25 #include "views/controls/table/table_model_observer.h" |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 // Number of bookmarks shown in recently bookmarked. | 30 // Number of bookmarks shown in recently bookmarked. |
| 30 const int kRecentlyBookmarkedCount = 50; | 31 const int kRecentlyBookmarkedCount = 50; |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 return title; | 320 return title; |
| 320 } | 321 } |
| 321 | 322 |
| 322 case IDS_BOOKMARK_TABLE_URL: { | 323 case IDS_BOOKMARK_TABLE_URL: { |
| 323 if (!node->is_url()) | 324 if (!node->is_url()) |
| 324 return std::wstring(); | 325 return std::wstring(); |
| 325 std::wstring languages = model_ && model_->profile() | 326 std::wstring languages = model_ && model_->profile() |
| 326 ? model_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages) | 327 ? model_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages) |
| 327 : std::wstring(); | 328 : std::wstring(); |
| 328 std::wstring url_text = | 329 std::wstring url_text = |
| 329 net::FormatUrl(node->GetURL(), languages, false, true, NULL, NULL); | 330 net::FormatUrl(node->GetURL(), languages, false, UnescapeRule::SPACES, |
| 331 NULL, NULL); |
| 330 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) | 332 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) |
| 331 l10n_util::WrapStringWithLTRFormatting(&url_text); | 333 l10n_util::WrapStringWithLTRFormatting(&url_text); |
| 332 return url_text; | 334 return url_text; |
| 333 } | 335 } |
| 334 | 336 |
| 335 case IDS_BOOKMARK_TABLE_PATH: { | 337 case IDS_BOOKMARK_TABLE_PATH: { |
| 336 std::wstring path; | 338 std::wstring path; |
| 337 BuildPath(node->GetParent(), &path); | 339 BuildPath(node->GetParent(), &path); |
| 338 // Force path to have LTR directionality. The whole path (but not every | 340 // Force path to have LTR directionality. The whole path (but not every |
| 339 // single path component) is marked with LRE-PDF. For example, | 341 // single path component) is marked with LRE-PDF. For example, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 return; | 404 return; |
| 403 } | 405 } |
| 404 if (node == model()->other_node()) { | 406 if (node == model()->other_node()) { |
| 405 *path = l10n_util::GetString(IDS_BOOKMARK_TABLE_OTHER_BOOKMARKS_PATH); | 407 *path = l10n_util::GetString(IDS_BOOKMARK_TABLE_OTHER_BOOKMARKS_PATH); |
| 406 return; | 408 return; |
| 407 } | 409 } |
| 408 BuildPath(node->GetParent(), path); | 410 BuildPath(node->GetParent(), path); |
| 409 path->append(l10n_util::GetString(IDS_BOOKMARK_TABLE_PATH_SEPARATOR)); | 411 path->append(l10n_util::GetString(IDS_BOOKMARK_TABLE_PATH_SEPARATOR)); |
| 410 path->append(node->GetTitle()); | 412 path->append(node->GetTitle()); |
| 411 } | 413 } |
| OLD | NEW |