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

Side by Side Diff: mojo/shell/fetcher/data_fetcher.cc

Issue 1563413002: Move fetchers into mojo/shell/fetcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/shell/fetcher/data_fetcher.h ('k') | mojo/shell/fetcher/data_fetcher_unittest.cc » ('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/fetcher/data_fetcher.h" 5 #include "mojo/shell/fetcher/data_fetcher.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
17 #include "mojo/public/cpp/system/data_pipe.h" 17 #include "mojo/public/cpp/system/data_pipe.h"
18 #include "net/base/data_url.h" 18 #include "net/base/data_url.h"
19 19
20 namespace mojo { 20 namespace mojo {
21 namespace fetcher { 21 namespace shell {
22 22
23 ScopedDataPipeConsumerHandle CreateConsumerHandleForString( 23 ScopedDataPipeConsumerHandle CreateConsumerHandleForString(
24 const std::string& data) { 24 const std::string& data) {
25 if (data.size() > std::numeric_limits<uint32_t>::max()) 25 if (data.size() > std::numeric_limits<uint32_t>::max())
26 return ScopedDataPipeConsumerHandle(); 26 return ScopedDataPipeConsumerHandle();
27 uint32_t num_bytes = static_cast<uint32_t>(data.size()); 27 uint32_t num_bytes = static_cast<uint32_t>(data.size());
28 MojoCreateDataPipeOptions options; 28 MojoCreateDataPipeOptions options;
29 options.struct_size = sizeof(MojoCreateDataPipeOptions); 29 options.struct_size = sizeof(MojoCreateDataPipeOptions);
30 options.flags = MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE; 30 options.flags = MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE;
31 options.element_num_bytes = 1; 31 options.element_num_bytes = 1;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 bool DataFetcher::PeekFirstLine(std::string* line) { 110 bool DataFetcher::PeekFirstLine(std::string* line) {
111 // This is only called for 'mojo magic' (i.e. detecting shebang'ed 111 // This is only called for 'mojo magic' (i.e. detecting shebang'ed
112 // content-handler. Since HasMojoMagic() returns false above, this should 112 // content-handler. Since HasMojoMagic() returns false above, this should
113 // never be reached. 113 // never be reached.
114 NOTREACHED(); 114 NOTREACHED();
115 return false; 115 return false;
116 } 116 }
117 117
118 } // namespace fetcher 118 } // namespace shell
119 } // namespace mojo 119 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/fetcher/data_fetcher.h ('k') | mojo/shell/fetcher/data_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698