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

Side by Side Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 2786583002: chromeos: Check both original and absolute paths for file: scheme (Closed)
Patch Set: remove dcheck Created 3 years, 6 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
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 "chrome/browser/net/chrome_network_delegate.h" 5 #include "chrome/browser/net/chrome_network_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 BrowserThread::UI, FROM_HERE, 440 BrowserThread::UI, FROM_HERE,
441 base::BindOnce(&TabSpecificContentSettings::CookieChanged, 441 base::BindOnce(&TabSpecificContentSettings::CookieChanged,
442 info->GetWebContentsGetterForRequest(), request.url(), 442 info->GetWebContentsGetterForRequest(), request.url(),
443 request.first_party_for_cookies(), cookie_line, *options, 443 request.first_party_for_cookies(), cookie_line, *options,
444 !allow)); 444 !allow));
445 } 445 }
446 446
447 return allow; 447 return allow;
448 } 448 }
449 449
450 bool ChromeNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, 450 bool ChromeNetworkDelegate::OnCanAccessFile(
451 const base::FilePath& path) const { 451 const net::URLRequest& request,
452 const base::FilePath& original_path,
453 const base::FilePath& absolute_path) const {
452 #if defined(OS_CHROMEOS) 454 #if defined(OS_CHROMEOS)
453 // browser_tests and interactive_ui_tests rely on the ability to open any 455 // browser_tests and interactive_ui_tests rely on the ability to open any
454 // files via file: scheme. 456 // files via file: scheme.
455 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) 457 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType))
456 return true; 458 return true;
457 #endif 459 #endif
458 460
459 return IsAccessAllowed(path, profile_path_); 461 #if defined(OS_ANDROID)
462 // Android's whitelist relies on symbolic links (ex. /sdcard is whitelisted
463 // and commonly a symbolic link), thus do not check absolute paths.
464 return IsAccessAllowed(original_path, profile_path_);
465 #else
466 return (IsAccessAllowed(original_path, profile_path_) &&
467 IsAccessAllowed(absolute_path, profile_path_));
468 #endif
460 } 469 }
461 470
462 // static 471 // static
463 bool ChromeNetworkDelegate::IsAccessAllowed( 472 bool ChromeNetworkDelegate::IsAccessAllowed(
464 const base::FilePath& path, 473 const base::FilePath& path,
465 const base::FilePath& profile_path) { 474 const base::FilePath& profile_path) {
466 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 475 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
467 return true; 476 return true;
468 #else 477 #else
469 478
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 if (!data_use_aggregator_) 597 if (!data_use_aggregator_)
589 return; 598 return;
590 599
591 if (is_data_usage_off_the_record_) { 600 if (is_data_usage_off_the_record_) {
592 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); 601 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes);
593 return; 602 return;
594 } 603 }
595 604
596 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); 605 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes);
597 } 606 }
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.h ('k') | chrome/browser/net/chrome_network_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698