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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // If we're running Chrome for ChromeOS on Linux, we want to allow file | 455 // If we're running Chrome for ChromeOS on Linux, we want to allow file |
454 // access. This is checked here to make IsAccessAllowed() unit-testable. | 456 // access. This is checked here to make IsAccessAllowed() unit-testable. |
455 if (!base::SysInfo::IsRunningOnChromeOS() || | 457 if (!base::SysInfo::IsRunningOnChromeOS() || |
456 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { | 458 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { |
457 return true; | 459 return true; |
458 } | 460 } |
459 #endif | 461 #endif |
460 | 462 |
461 return IsAccessAllowed(path, profile_path_); | 463 #if defined(OS_ANDROID) |
| 464 // Android's whitelist relies on symbolic links (ex. /sdcard is whitelisted |
| 465 // and commonly a symbolic link), thus do not check absolute paths. |
| 466 return IsAccessAllowed(original_path, profile_path_); |
| 467 #else |
| 468 return (IsAccessAllowed(original_path, profile_path_) && |
| 469 IsAccessAllowed(absolute_path, profile_path_)); |
| 470 #endif |
462 } | 471 } |
463 | 472 |
464 // static | 473 // static |
465 bool ChromeNetworkDelegate::IsAccessAllowed( | 474 bool ChromeNetworkDelegate::IsAccessAllowed( |
466 const base::FilePath& path, | 475 const base::FilePath& path, |
467 const base::FilePath& profile_path) { | 476 const base::FilePath& profile_path) { |
468 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) | 477 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
469 return true; | 478 return true; |
470 #else | 479 #else |
471 | 480 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 if (!data_use_aggregator_) | 563 if (!data_use_aggregator_) |
555 return; | 564 return; |
556 | 565 |
557 if (is_data_usage_off_the_record_) { | 566 if (is_data_usage_off_the_record_) { |
558 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); | 567 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); |
559 return; | 568 return; |
560 } | 569 } |
561 | 570 |
562 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); | 571 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); |
563 } | 572 } |
OLD | NEW |