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

Side by Side Diff: chrome/browser/download/download_item.cc

Issue 6246036: FilePath: Remove most of ToWStringHack, adding a LossyDisplayName() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: retry Created 9 years, 10 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) 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
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 if (path.find(query) != std::wstring::npos)
Mark Mentovai 2011/02/04 19:26:58 string16::find doesn’t seem like the right way to
evanm 2011/02/04 19:37:12 I guess for strict substring it's ok, because exte
Avi (use Gerrit) 2011/02/04 19:42:32 For strict substring, this is valid.
Mark Mentovai 2011/02/04 19:49:32 evanm wrote:
evanm 2011/02/04 19:58:50 Good point. Filed a bug, added a link.
491 return true; 491 return true;
492 492
493 return false; 493 return false;
494 } 494 }
495 495
496 void DownloadItem::SetFileCheckResults(const FilePath& path, 496 void DownloadItem::SetFileCheckResults(const FilePath& path,
497 bool is_dangerous, 497 bool is_dangerous,
498 int path_uniquifier, 498 int path_uniquifier,
499 bool prompt, 499 bool prompt,
500 bool is_extension_install, 500 bool is_extension_install,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 target_name_.value().c_str(), 578 target_name_.value().c_str(),
579 full_path().value().c_str()); 579 full_path().value().c_str());
580 } else { 580 } else {
581 description += base::StringPrintf(" url = \"%s\"", url().spec().c_str()); 581 description += base::StringPrintf(" url = \"%s\"", url().spec().c_str());
582 } 582 }
583 583
584 description += " }"; 584 description += " }";
585 585
586 return description; 586 return description;
587 } 587 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698