| 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 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 if (!data_use_aggregator_) | 561 if (!data_use_aggregator_) |
| 553 return; | 562 return; |
| 554 | 563 |
| 555 if (is_data_usage_off_the_record_) { | 564 if (is_data_usage_off_the_record_) { |
| 556 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); | 565 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); |
| 557 return; | 566 return; |
| 558 } | 567 } |
| 559 | 568 |
| 560 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); | 569 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); |
| 561 } | 570 } |
| OLD | NEW |