Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Unified Diff: mojo/shell/network_delegate.cc

Issue 38303002: Enable Mojo to download from file URLs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/shell/network_delegate.h ('k') | mojo/shell/url_request_context_getter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/network_delegate.cc
diff --git a/mojo/shell/network_delegate.cc b/mojo/shell/network_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7359def0f2e57f2c49132925f1d1d0d5c11a397c
--- /dev/null
+++ b/mojo/shell/network_delegate.cc
@@ -0,0 +1,27 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/shell/network_delegate.h"
+
+#include "base/command_line.h"
+#include "mojo/shell/switches.h"
+#include "net/url_request/url_request.h"
+
+namespace mojo {
+namespace shell {
+
+NetworkDelegate::NetworkDelegate() {
+ DetachFromThread();
+}
+
+bool NetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
+ const base::FilePath& path) const {
+ // TODO(aa): We might want to add a --allow-file-urls or something, but
+ // starting conservative.
+ return CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kApp)
+ == request.url().spec();
+}
+
+} // namespace shell
+} // namespace mojo
« no previous file with comments | « mojo/shell/network_delegate.h ('k') | mojo/shell/url_request_context_getter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698