| 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(const net::URLRequest& request, |
| 451 const base::FilePath& path) const { | 451 const base::FilePath& path) const { |
| 452 #if defined(OS_CHROMEOS) | 452 #if defined(OS_CHROMEOS) |
| 453 // If we're running Chrome for ChromeOS on Linux, we want to allow file | 453 // 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. | 454 // access. This is checked here to make IsAccessAllowed() unit-testable. |
| 455 if (!base::SysInfo::IsRunningOnChromeOS() || | 455 if (!base::SysInfo::IsRunningOnChromeOS()) |
| 456 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { | |
| 457 return true; | 456 return true; |
| 458 } | |
| 459 #endif | 457 #endif |
| 460 | 458 |
| 461 return IsAccessAllowed(path, profile_path_); | 459 return IsAccessAllowed(path, profile_path_); |
| 462 } | 460 } |
| 463 | 461 |
| 464 // static | 462 // static |
| 465 bool ChromeNetworkDelegate::IsAccessAllowed( | 463 bool ChromeNetworkDelegate::IsAccessAllowed( |
| 466 const base::FilePath& path, | 464 const base::FilePath& path, |
| 467 const base::FilePath& profile_path) { | 465 const base::FilePath& profile_path) { |
| 468 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) | 466 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 if (!data_use_aggregator_) | 552 if (!data_use_aggregator_) |
| 555 return; | 553 return; |
| 556 | 554 |
| 557 if (is_data_usage_off_the_record_) { | 555 if (is_data_usage_off_the_record_) { |
| 558 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); | 556 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); |
| 559 return; | 557 return; |
| 560 } | 558 } |
| 561 | 559 |
| 562 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); | 560 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); |
| 563 } | 561 } |
| OLD | NEW |