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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(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 // browser_tests and interactive_ui_tests rely on the ability to open any |
454 // access. This is checked here to make IsAccessAllowed() unit-testable. | 454 // files via file: scheme. |
455 if (!base::SysInfo::IsRunningOnChromeOS()) | 455 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) |
456 return true; | 456 return true; |
457 #endif | 457 #endif |
458 | 458 |
459 return IsAccessAllowed(path, profile_path_); | 459 return IsAccessAllowed(path, profile_path_); |
460 } | 460 } |
461 | 461 |
462 // static | 462 // static |
463 bool ChromeNetworkDelegate::IsAccessAllowed( | 463 bool ChromeNetworkDelegate::IsAccessAllowed( |
464 const base::FilePath& path, | 464 const base::FilePath& path, |
465 const base::FilePath& profile_path) { | 465 const base::FilePath& profile_path) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 if (!data_use_aggregator_) | 552 if (!data_use_aggregator_) |
553 return; | 553 return; |
554 | 554 |
555 if (is_data_usage_off_the_record_) { | 555 if (is_data_usage_off_the_record_) { |
556 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); | 556 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); |
557 return; | 557 return; |
558 } | 558 } |
559 | 559 |
560 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); | 560 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); |
561 } | 561 } |
OLD | NEW |