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