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

Side by Side Diff: mojo/fetcher/local_fetcher.cc

Issue 1342503003: Move fetching logic out of ApplicationManager, eliminate url mappings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « mojo/fetcher/local_fetcher.h ('k') | mojo/fetcher/network_fetcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "mojo/shell/local_fetcher.h" 5 #include "mojo/fetcher/local_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
14 #include "mojo/common/common_type_converters.h" 14 #include "mojo/common/common_type_converters.h"
15 #include "mojo/common/data_pipe_utils.h" 15 #include "mojo/common/data_pipe_utils.h"
16 #include "mojo/common/url_type_converters.h" 16 #include "mojo/common/url_type_converters.h"
17 #include "mojo/services/network/public/interfaces/network_service.mojom.h" 17 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
18 #include "mojo/util/filename_util.h" 18 #include "mojo/util/filename_util.h"
19 #include "url/url_util.h" 19 #include "url/url_util.h"
20 20
21 namespace mojo { 21 namespace mojo {
22 namespace shell { 22 namespace fetcher {
23 23
24 namespace { 24 namespace {
25
26 void IgnoreResult(bool result) { 25 void IgnoreResult(bool result) {
27 } 26 }
28 27
29 } // namespace 28 } // namespace
30 29
31 // A loader for local files. 30 // A loader for local files.
32 LocalFetcher::LocalFetcher(NetworkService* network_service, 31 LocalFetcher::LocalFetcher(NetworkService* network_service,
33 const GURL& url, 32 const GURL& url,
34 const GURL& url_without_query, 33 const GURL& url_without_query,
35 const FetchCallback& loader_callback) 34 const FetchCallback& loader_callback)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 bool LocalFetcher::PeekFirstLine(std::string* line) { 105 bool LocalFetcher::PeekFirstLine(std::string* line) {
107 std::string start_of_file; 106 std::string start_of_file;
108 ReadFileToString(path_, &start_of_file, kMaxShebangLength); 107 ReadFileToString(path_, &start_of_file, kMaxShebangLength);
109 size_t return_position = start_of_file.find('\n'); 108 size_t return_position = start_of_file.find('\n');
110 if (return_position == std::string::npos) 109 if (return_position == std::string::npos)
111 return false; 110 return false;
112 *line = start_of_file.substr(0, return_position + 1); 111 *line = start_of_file.substr(0, return_position + 1);
113 return true; 112 return true;
114 } 113 }
115 114
116 } // namespace shell 115 } // namespace fetcher
117 } // namespace mojo 116 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/fetcher/local_fetcher.h ('k') | mojo/fetcher/network_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698