OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_FETCHER_UPDATE_FETCHER_H_ | |
6 #define MOJO_FETCHER_UPDATE_FETCHER_H_ | |
7 | |
8 #include "mojo/shell/fetcher.h" | |
9 | |
10 #include "base/files/file_path.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "mojo/services/updater/updater.mojom.h" | |
13 #include "url/gurl.h" | |
14 | |
15 namespace mojo { | |
16 | |
17 class URLLoaderFactory; | |
18 | |
19 namespace fetcher { | |
20 | |
21 class UpdateFetcher : public shell::Fetcher { | |
22 public: | |
23 UpdateFetcher(const GURL& url, | |
24 updater::Updater* updater, | |
25 const FetchCallback& loader_callback); | |
26 | |
27 ~UpdateFetcher() override; | |
28 | |
29 private: | |
30 // Fetcher implementation: | |
31 const GURL& GetURL() const override; | |
32 GURL GetRedirectURL() const override; | |
33 GURL GetRedirectReferer() const override; | |
34 URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, | |
35 uint32_t skip) override; | |
36 void AsPath( | |
37 base::TaskRunner* task_runner, | |
38 base::Callback<void(const base::FilePath&, bool)> callback) override; | |
39 std::string MimeType() override; | |
40 bool HasMojoMagic() override; | |
41 bool PeekFirstLine(std::string* line) override; | |
42 | |
43 void OnGetAppPath(const mojo::String& path); | |
44 | |
45 const GURL url_; | |
46 base::FilePath path_; | |
47 base::WeakPtrFactory<UpdateFetcher> weak_ptr_factory_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(UpdateFetcher); | |
50 }; | |
51 | |
52 } // namespace fetcher | |
53 } // namespace mojo | |
54 | |
55 #endif // MOJO_FETCHER_UPDATE_FETCHER_H_ | |
OLD | NEW |