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

Side by Side Diff: net/base/net_util.cc

Issue 9854011: Normalize download file name on chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/base/net_util.h" 5 #include "net/base/net_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 10
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 referrer_charset, 1498 referrer_charset,
1499 suggested_name, 1499 suggested_name,
1500 mime_type, 1500 mime_type,
1501 default_file_name); 1501 default_file_name);
1502 1502
1503 #if defined(OS_WIN) 1503 #if defined(OS_WIN)
1504 FilePath generated_name(file_name); 1504 FilePath generated_name(file_name);
1505 #else 1505 #else
1506 FilePath generated_name(base::SysWideToNativeMB(UTF16ToWide(file_name))); 1506 FilePath generated_name(base::SysWideToNativeMB(UTF16ToWide(file_name)));
1507 #endif 1507 #endif
1508
1509 #if defined(OS_CHROMEOS)
1510 // When doing file manager operations on ChromeOS, the file paths get
1511 // normalized in WebKit layer, so let's ensure downloaded files have
1512 // normalized names. Otherwise, we won't be able to handle files with NFD
1513 // utf8 encoded characters in name.
1514 file_util::NormalizeFileNameEncoding(&generated_name);
1515 #endif
1516
1508 DCHECK(!generated_name.empty()); 1517 DCHECK(!generated_name.empty());
1509 1518
1510 return generated_name; 1519 return generated_name;
1511 } 1520 }
1512 1521
1513 bool IsPortAllowedByDefault(int port) { 1522 bool IsPortAllowedByDefault(int port) {
1514 int array_size = arraysize(kRestrictedPorts); 1523 int array_size = arraysize(kRestrictedPorts);
1515 for (int i = 0; i < array_size; i++) { 1524 for (int i = 0; i < array_size; i++) {
1516 if (kRestrictedPorts[i] == port) { 1525 if (kRestrictedPorts[i] == port) {
1517 return false; 1526 return false;
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
2412 2421
2413 NetworkInterface::NetworkInterface(const std::string& name, 2422 NetworkInterface::NetworkInterface(const std::string& name,
2414 const IPAddressNumber& address) 2423 const IPAddressNumber& address)
2415 : name(name), address(address) { 2424 : name(name), address(address) {
2416 } 2425 }
2417 2426
2418 NetworkInterface::~NetworkInterface() { 2427 NetworkInterface::~NetworkInterface() {
2419 } 2428 }
2420 2429
2421 } // namespace net 2430 } // namespace net
OLDNEW
« no previous file with comments | « chrome/browser/download/save_package_file_picker_chromeos.cc ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698