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"
17 class URLLoaderFactory
;
21 class UpdateFetcher
: public Fetcher
{
23 UpdateFetcher(const GURL
& url
,
24 updater::Updater
* updater
,
25 const FetchCallback
& loader_callback
);
27 ~UpdateFetcher() override
;
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
;
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
);
47 base::WeakPtrFactory
<UpdateFetcher
> weak_ptr_factory_
;
49 DISALLOW_COPY_AND_ASSIGN(UpdateFetcher
);
55 #endif // MOJO_SHELL_UPDATE_FETCHER_H_