OLD | NEW |
---|---|
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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
441 BrowserThread::UI, FROM_HERE, | 441 BrowserThread::UI, FROM_HERE, |
442 base::Bind(&TabSpecificContentSettings::CookieChanged, | 442 base::Bind(&TabSpecificContentSettings::CookieChanged, |
443 info->GetWebContentsGetterForRequest(), | 443 info->GetWebContentsGetterForRequest(), |
444 request.url(), request.first_party_for_cookies(), | 444 request.url(), request.first_party_for_cookies(), |
445 cookie_line, *options, !allow)); | 445 cookie_line, *options, !allow)); |
446 } | 446 } |
447 | 447 |
448 return allow; | 448 return allow; |
449 } | 449 } |
450 | 450 |
451 bool ChromeNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, | 451 bool ChromeNetworkDelegate::OnCanAccessFile( |
452 const base::FilePath& path) const { | 452 const net::URLRequest& request, |
453 const base::FilePath& original_path, | |
454 const base::FilePath& absolute_path) const { | |
453 #if defined(OS_CHROMEOS) | 455 #if defined(OS_CHROMEOS) |
454 // If we're running Chrome for ChromeOS on Linux, we want to allow file | 456 // If we're running Chrome for ChromeOS on Linux, we want to allow file |
455 // access. This is checked here to make IsAccessAllowed() unit-testable. | 457 // access. This is checked here to make IsAccessAllowed() unit-testable. |
456 if (!base::SysInfo::IsRunningOnChromeOS() || | 458 if (!base::SysInfo::IsRunningOnChromeOS() || |
457 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { | 459 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { |
458 return true; | 460 return true; |
459 } | 461 } |
460 #endif | 462 #endif |
461 | 463 |
464 #if defined(OS_CHROMEOS) | |
465 // Use the absolute path on Chrome OS so that symbolic links that point to | |
466 // paths outside of the whitelist are rejected. | |
467 const base::FilePath& path = absolute_path; | |
468 #else | |
469 // Use the original path on Android. Android's whitelist relies on symbolic | |
470 // links (ex. /sdcard is whitelisted and commonly a symbolic link). | |
471 const base::FilePath& path = original_path; | |
mmenke
2017/04/18 17:24:45
These should be reviewed by someone more familiar
satorux1
2017/04/19 07:22:22
Thanks. I'll ask jorgelo@ for a review once the pa
satorux1
2017/05/09 07:44:09
Changed to check both by default.
| |
472 #endif | |
462 return IsAccessAllowed(path, profile_path_); | 473 return IsAccessAllowed(path, profile_path_); |
463 } | 474 } |
464 | 475 |
465 // static | 476 // static |
466 bool ChromeNetworkDelegate::IsAccessAllowed( | 477 bool ChromeNetworkDelegate::IsAccessAllowed( |
467 const base::FilePath& path, | 478 const base::FilePath& path, |
468 const base::FilePath& profile_path) { | 479 const base::FilePath& profile_path) { |
469 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) | 480 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
470 return true; | 481 return true; |
471 #else | 482 #else |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 if (!data_use_aggregator_) | 566 if (!data_use_aggregator_) |
556 return; | 567 return; |
557 | 568 |
558 if (is_data_usage_off_the_record_) { | 569 if (is_data_usage_off_the_record_) { |
559 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); | 570 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); |
560 return; | 571 return; |
561 } | 572 } |
562 | 573 |
563 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); | 574 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); |
564 } | 575 } |
OLD | NEW |