OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/download/download_item.h" | 5 #include "chrome/browser/download/download_item.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 // A good test case would be: | 479 // A good test case would be: |
480 // "/\xe4\xbd\xa0\xe5\xa5\xbd\xe4\xbd\xa0\xe5\xa5\xbd", | 480 // "/\xe4\xbd\xa0\xe5\xa5\xbd\xe4\xbd\xa0\xe5\xa5\xbd", |
481 // L"/\x4f60\x597d\x4f60\x597d", | 481 // L"/\x4f60\x597d\x4f60\x597d", |
482 // "/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD" | 482 // "/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD" |
483 PrefService* prefs = download_manager_->profile()->GetPrefs(); | 483 PrefService* prefs = download_manager_->profile()->GetPrefs(); |
484 std::string languages(prefs->GetString(prefs::kAcceptLanguages)); | 484 std::string languages(prefs->GetString(prefs::kAcceptLanguages)); |
485 string16 url_formatted(l10n_util::ToLower(net::FormatUrl(url_, languages))); | 485 string16 url_formatted(l10n_util::ToLower(net::FormatUrl(url_, languages))); |
486 if (url_formatted.find(query) != string16::npos) | 486 if (url_formatted.find(query) != string16::npos) |
487 return true; | 487 return true; |
488 | 488 |
489 string16 path(l10n_util::ToLower(WideToUTF16(full_path().ToWStringHack()))); | 489 string16 path(l10n_util::ToLower(full_path().LossyDisplayName())); |
490 if (path.find(query) != std::wstring::npos) | 490 // This shouldn't just do a substring match; it is wrong for Unicode |
| 491 // due to normalization and we have a fancier search-query system |
| 492 // used elsewhere. |
| 493 // http://code.google.com/p/chromium/issues/detail?id=71982 |
| 494 if (path.find(query) != string16::npos) |
491 return true; | 495 return true; |
492 | 496 |
493 return false; | 497 return false; |
494 } | 498 } |
495 | 499 |
496 void DownloadItem::SetFileCheckResults(const FilePath& path, | 500 void DownloadItem::SetFileCheckResults(const FilePath& path, |
497 bool is_dangerous, | 501 bool is_dangerous, |
498 int path_uniquifier, | 502 int path_uniquifier, |
499 bool prompt, | 503 bool prompt, |
500 bool is_extension_install, | 504 bool is_extension_install, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 target_name_.value().c_str(), | 582 target_name_.value().c_str(), |
579 full_path().value().c_str()); | 583 full_path().value().c_str()); |
580 } else { | 584 } else { |
581 description += base::StringPrintf(" url = \"%s\"", url().spec().c_str()); | 585 description += base::StringPrintf(" url = \"%s\"", url().spec().c_str()); |
582 } | 586 } |
583 | 587 |
584 description += " }"; | 588 description += " }"; |
585 | 589 |
586 return description; | 590 return description; |
587 } | 591 } |
OLD | NEW |