Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / mojo / shell / update_fetcher.h
blob26c82df40cf42c4baff02b9187ccc118a7c631e2
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.
5 #ifndef MOJO_SHELL_UPDATE_FETCHER_H_
6 #define MOJO_SHELL_UPDATE_FETCHER_H_
8 #include "mojo/shell/fetcher.h"
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"
15 namespace mojo {
17 class URLLoaderFactory;
19 namespace shell {
21 class UpdateFetcher : public Fetcher {
22 public:
23 UpdateFetcher(const GURL& url,
24 updater::Updater* updater,
25 const FetchCallback& loader_callback);
27 ~UpdateFetcher() override;
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;
43 void OnGetAppPath(const mojo::String& path);
45 const GURL url_;
46 base::FilePath path_;
47 base::WeakPtrFactory<UpdateFetcher> weak_ptr_factory_;
49 DISALLOW_COPY_AND_ASSIGN(UpdateFetcher);
52 } // namespace shell
53 } // namespace mojo
55 #endif // MOJO_SHELL_UPDATE_FETCHER_H_