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

Side by Side Diff: net/url_request/url_request_file_job.cc

Issue 5785002: Add /media to whitelist so it can be accessed with file:// protocol on Chrome... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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 // For loading files, we make use of overlapped i/o to ensure that reading from 5 // For loading files, we make use of overlapped i/o to ensure that reading from
6 // the filesystem (e.g., a network filesystem) does not block the calling 6 // the filesystem (e.g., a network filesystem) does not block the calling
7 // thread. An alternative approach would be to use a background thread or pool 7 // thread. An alternative approach would be to use a background thread or pool
8 // of threads, but it seems better to leverage the operating system's ability 8 // of threads, but it seems better to leverage the operating system's ability
9 // to do background file reads for us. 9 // to do background file reads for us.
10 // 10 //
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 *http_status_code = 301; 356 *http_status_code = 301;
357 return true; 357 return true;
358 #else 358 #else
359 return false; 359 return false;
360 #endif 360 #endif
361 } 361 }
362 362
363 #if defined(OS_CHROMEOS) 363 #if defined(OS_CHROMEOS)
364 static const char* const kLocalAccessWhiteList[] = { 364 static const char* const kLocalAccessWhiteList[] = {
365 "/home/chronos/user/Downloads", 365 "/home/chronos/user/Downloads",
366 "/media",
366 "/mnt/partner_partition", 367 "/mnt/partner_partition",
367 "/usr/share/chromeos-assets", 368 "/usr/share/chromeos-assets",
368 "/tmp", 369 "/tmp",
369 "/var/log", 370 "/var/log",
370 }; 371 };
371 372
372 // static 373 // static
373 bool URLRequestFileJob::AccessDisabled(const FilePath& file_path) { 374 bool URLRequestFileJob::AccessDisabled(const FilePath& file_path) {
374 if (net::URLRequest::IsFileAccessAllowed()) { // for tests. 375 if (net::URLRequest::IsFileAccessAllowed()) { // for tests.
375 return false; 376 return false;
376 } 377 }
377 378
378 for (size_t i = 0; i < arraysize(kLocalAccessWhiteList); ++i) { 379 for (size_t i = 0; i < arraysize(kLocalAccessWhiteList); ++i) {
379 const FilePath white_listed_path(kLocalAccessWhiteList[i]); 380 const FilePath white_listed_path(kLocalAccessWhiteList[i]);
380 // FilePath::operator== should probably handle trailing seperators. 381 // FilePath::operator== should probably handle trailing seperators.
381 if (white_listed_path == file_path.StripTrailingSeparators() || 382 if (white_listed_path == file_path.StripTrailingSeparators() ||
382 white_listed_path.IsParent(file_path)) { 383 white_listed_path.IsParent(file_path)) {
383 return false; 384 return false;
384 } 385 }
385 } 386 }
386 return true; 387 return true;
387 } 388 }
388 #endif 389 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698