OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chromecast/service/cast_network_delegate.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" |
| 9 #include "chromecast/common/chromecast_switches.h" |
| 10 |
| 11 namespace chromecast { |
| 12 |
| 13 CastNetworkDelegate::CastNetworkDelegate() { |
| 14 DetachFromThread(); |
| 15 } |
| 16 |
| 17 CastNetworkDelegate::~CastNetworkDelegate() { |
| 18 } |
| 19 |
| 20 bool CastNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, |
| 21 const base::FilePath& path) const { |
| 22 #if defined(OS_ANDROID) |
| 23 // On Chromecast, there's no reason to allow local file access. |
| 24 if (base::CommandLine::ForCurrentProcess()-> |
| 25 HasSwitch(switches::kEnableLocalFileAccesses)) { |
| 26 return true; |
| 27 } |
| 28 #endif // defined(OS_ANDROID) |
| 29 |
| 30 LOG(WARNING) << "Could not access file " << path.value() |
| 31 << ". All file accesses are forbidden."; |
| 32 return false; |
| 33 } |
| 34 |
| 35 } // namespace chromecast |
OLD | NEW |