OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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 "base/logging.h" | |
6 #include "services/media/framework/parts/file_reader.h" | |
7 #include "services/media/framework/parts/reader.h" | |
8 #include "url/gurl.h" | |
9 | |
10 namespace mojo { | |
11 namespace media { | |
12 | |
13 Result Reader::Create(const GURL& gurl, ReaderPtr* reader_out) { | |
14 if (!gurl.is_valid()) { | |
15 return Result::kInvalidArgument; | |
16 } | |
17 | |
18 ReaderPtr reader = nullptr; | |
19 if (gurl.SchemeIsFile()) { | |
20 reader = FileReader::New(); | |
21 } | |
22 // TODO(dalesat): More schemes. | |
jeffbrown
2016/02/02 05:35:48
Honestly this code doesn't belong in your framewor
dalesat
2016/02/02 21:46:40
I agree that *most* of the resolution should be do
| |
23 | |
24 if (reader == nullptr) { | |
25 return Result::kUnsupportedOperation; | |
26 } | |
27 | |
28 Result result = reader->Init(gurl); | |
29 if (result == Result::kOk) { | |
30 *reader_out = reader; | |
31 } | |
32 | |
33 return result; | |
34 } | |
35 | |
36 } // namespace media | |
37 } // namespace mojo | |
OLD | NEW |