Chromium Code Reviews| Index: mojo/runner/about_fetcher.h |
| diff --git a/mojo/runner/about_fetcher.h b/mojo/runner/about_fetcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5074c2f366a4f2e88ad6245304df82fbe064bd3c |
| --- /dev/null |
| +++ b/mojo/runner/about_fetcher.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MOJO_RUNNER_ABOUT_FETCHER_H_ |
| +#define MOJO_RUNNER_ABOUT_FETCHER_H_ |
| + |
| +#include "mojo/shell/fetcher.h" |
| + |
| +#include "base/macros.h" |
| +#include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| +#include "url/gurl.h" |
| + |
| +namespace mojo { |
| +namespace runner { |
| + |
| +// Implements Fetcher for about: URLs. |
| +// Instances of this class must be allocated on the heap. They manage their own |
| +// lifespan. |
| +class AboutFetcher : public shell::Fetcher { |
|
sky
2015/08/04 20:04:56
The rest of the fetchers are in mojo/shell. Is the
yzshen1
2015/08/05 16:11:08
Because all the other fetchers are used by mojo/sh
sky
2015/08/05 17:35:49
Ok, makes sense.
|
| + public: |
| + static const char kAboutScheme[]; |
| + static const char kAboutBlankURL[]; |
| + |
| + AboutFetcher(const GURL& url, const FetchCallback& loader_callback); |
| + ~AboutFetcher() override; |
| + |
| + private: |
| + void BuildResponse(); |
| + |
| + // Must be called exactly once to run the loader callback (asynchrously). On |
| + // scuccess, the ownership of this object is passed to the loader callback; |
|
sky
2015/08/04 20:04:56
scuccess->success
yzshen1
2015/08/05 16:11:08
Done.
|
| + // otherwise, the callback is runned with a nullptr and this object is |
|
sky
2015/08/04 20:04:55
runned->run
yzshen1
2015/08/05 16:11:08
Done. Sorry.
|
| + // destroyed. |
| + void PostToRunCallback(bool success); |
| + |
| + // shell::Fetcher implementation. |
| + const GURL& GetURL() const override; |
| + GURL GetRedirectURL() const override; |
| + GURL GetRedirectReferer() const override; |
| + URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, |
| + uint32_t skip) override; |
| + void AsPath( |
| + base::TaskRunner* task_runner, |
| + base::Callback<void(const base::FilePath&, bool)> callback) override; |
| + std::string MimeType() override; |
| + bool HasMojoMagic() override; |
| + bool PeekFirstLine(std::string* line) override; |
| + |
| + const GURL url_; |
| + URLResponsePtr response_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AboutFetcher); |
| +}; |
| + |
| +} // namespace runner |
| +} // namespace mojo |
| + |
| +#endif // MOJO_RUNNER_ABOUT_FETCHER_H_ |