• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 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 "mojo/shell/network_delegate.h"
6 
7 #include "base/command_line.h"
8 #include "mojo/shell/switches.h"
9 #include "net/url_request/url_request.h"
10 
11 namespace mojo {
12 namespace shell {
13 
NetworkDelegate()14 NetworkDelegate::NetworkDelegate() {
15   DetachFromThread();
16 }
17 
OnCanAccessFile(const net::URLRequest & request,const base::FilePath & path) const18 bool NetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
19                                       const base::FilePath& path) const {
20   // TODO(aa): We might want to add a --allow-file-urls or something, but
21   // starting conservative.
22   return CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kApp)
23       == request.url().spec();
24 }
25 
26 }  // namespace shell
27 }  // namespace mojo
28