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 "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/time_format.h" | 10 #include "base/time_format.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 return std::wstring(); | 309 return std::wstring(); |
310 std::wstring url_text = UTF8ToWide(node->GetURL().spec()); | 310 std::wstring url_text = UTF8ToWide(node->GetURL().spec()); |
311 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) | 311 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) |
312 l10n_util::WrapStringWithLTRFormatting(&url_text); | 312 l10n_util::WrapStringWithLTRFormatting(&url_text); |
313 return url_text; | 313 return url_text; |
314 } | 314 } |
315 | 315 |
316 case IDS_BOOKMARK_TABLE_PATH: { | 316 case IDS_BOOKMARK_TABLE_PATH: { |
317 std::wstring path; | 317 std::wstring path; |
318 BuildPath(node->GetParent(), &path); | 318 BuildPath(node->GetParent(), &path); |
319 // Force path to have LTR directionality. The whole path needs to be | 319 // Force path to have LTR directionality. The whole path (but not every |
320 // marked with LRE-PDF, so that the path containing both LTR and RTL | 320 // single path component) is marked with LRE-PDF. For example, |
321 // subfolder names (such as "CBA/FED/(xji)/.x.j.", in which, "CBA" and | 321 // ALEPH/BET/GIMEL (using uppercase English for Hebrew) is supposed to |
322 // "FED" are subfolder names in Hebrew) can be displayed as LTR. | 322 // appear (visually) as LEMIG/TEB/HPELA; foo/C/B/A.doc refers to file |
| 323 // C.doc in directory B in directory A in directory foo, not to file |
| 324 // A.doc in directory B in directory C in directory foo. The reason to |
| 325 // mark the whole path, but not every single path component, as LTR is |
| 326 // because paths need to get written in text documents, and that is how |
| 327 // they will appear there. Being a saint and doing the tedious formatting |
| 328 // to every single path component to get it to come out in the logical |
| 329 // order will accomplish nothing but confuse people, since they will now |
| 330 // see both formats being used, and will never know what anything means. |
| 331 // Furthermore, doing the "logical" formatting with characters like LRM, |
| 332 // LRE, and PDF to every single path component means that when someone |
| 333 // copy/pastes your path, it will still contain those characters, and |
| 334 // trying to access the file will fail because of them. Windows Explorer, |
| 335 // Firefox, IE, Nautilus, gedit choose to format only the whole path as |
| 336 // LTR too. The point here is to display the path the same way as it's |
| 337 // displayed by other software. |
323 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) | 338 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) |
324 l10n_util::WrapStringWithLTRFormatting(&path); | 339 l10n_util::WrapStringWithLTRFormatting(&path); |
325 return path; | 340 return path; |
326 } | 341 } |
327 } | 342 } |
328 NOTREACHED(); | 343 NOTREACHED(); |
329 return std::wstring(); | 344 return std::wstring(); |
330 } | 345 } |
331 | 346 |
332 SkBitmap BookmarkTableModel::GetIcon(int row) { | 347 SkBitmap BookmarkTableModel::GetIcon(int row) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 if (node == model()->GetBookmarkBarNode()) { | 381 if (node == model()->GetBookmarkBarNode()) { |
367 *path = l10n_util::GetString(IDS_BOOKMARK_TABLE_BOOKMARK_BAR_PATH); | 382 *path = l10n_util::GetString(IDS_BOOKMARK_TABLE_BOOKMARK_BAR_PATH); |
368 return; | 383 return; |
369 } | 384 } |
370 if (node == model()->other_node()) { | 385 if (node == model()->other_node()) { |
371 *path = l10n_util::GetString(IDS_BOOKMARK_TABLE_OTHER_BOOKMARKS_PATH); | 386 *path = l10n_util::GetString(IDS_BOOKMARK_TABLE_OTHER_BOOKMARKS_PATH); |
372 return; | 387 return; |
373 } | 388 } |
374 BuildPath(node->GetParent(), path); | 389 BuildPath(node->GetParent(), path); |
375 path->append(l10n_util::GetString(IDS_BOOKMARK_TABLE_PATH_SEPARATOR)); | 390 path->append(l10n_util::GetString(IDS_BOOKMARK_TABLE_PATH_SEPARATOR)); |
376 // Force path to have LTR directionality. Otherwise, folder path "CBA/FED" | |
377 // (in which, "CBA" and "FED" stand for folder names in Hebrew, and "FED" is | |
378 // a subfolder of "CBA") will be displayed as "FED/CBA". | |
379 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { | |
380 path->push_back(static_cast<wchar_t>(l10n_util::kLeftToRightMark)); | |
381 } | |
382 path->append(node->GetTitle()); | 391 path->append(node->GetTitle()); |
383 } | 392 } |
OLD | NEW |