OLD | NEW |
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 "shell/application_manager/local_fetcher.h" | 5 #include "shell/application_manager/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/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "mojo/common/common_type_converters.h" | 13 #include "mojo/common/common_type_converters.h" |
14 #include "mojo/common/data_pipe_utils.h" | 14 #include "mojo/common/data_pipe_utils.h" |
15 #include "url/url_util.h" | 15 #include "url/url_util.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
| 18 namespace shell { |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 void IgnoreResult(bool result) { | 22 void IgnoreResult(bool result) { |
22 } | 23 } |
23 | 24 |
24 } // namespace | 25 } // namespace |
25 | 26 |
26 // A loader for local files. | 27 // A loader for local files. |
27 LocalFetcher::LocalFetcher(const GURL& url, | 28 LocalFetcher::LocalFetcher(const GURL& url, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 bool LocalFetcher::PeekFirstLine(std::string* line) { | 93 bool LocalFetcher::PeekFirstLine(std::string* line) { |
93 std::string start_of_file; | 94 std::string start_of_file; |
94 ReadFileToString(path_, &start_of_file, kMaxShebangLength); | 95 ReadFileToString(path_, &start_of_file, kMaxShebangLength); |
95 size_t return_position = start_of_file.find('\n'); | 96 size_t return_position = start_of_file.find('\n'); |
96 if (return_position == std::string::npos) | 97 if (return_position == std::string::npos) |
97 return false; | 98 return false; |
98 *line = start_of_file.substr(0, return_position + 1); | 99 *line = start_of_file.substr(0, return_position + 1); |
99 return true; | 100 return true; |
100 } | 101 } |
101 | 102 |
| 103 } // namespace shell |
102 } // namespace mojo | 104 } // namespace mojo |
OLD | NEW |