Chromium Code Reviews| 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_RUNNER_ABOUT_FETCHER_H_ | |
| 6 #define MOJO_RUNNER_ABOUT_FETCHER_H_ | |
| 7 | |
| 8 #include "mojo/shell/fetcher.h" | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | |
| 12 #include "url/gurl.h" | |
| 13 | |
| 14 namespace mojo { | |
| 15 namespace runner { | |
| 16 | |
| 17 // Implements Fetcher for about: URLs. | |
| 18 // Instances of this class must be allocated on the heap. They manage their own | |
| 19 // lifespan. | |
| 20 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.
| |
| 21 public: | |
| 22 static const char kAboutScheme[]; | |
| 23 static const char kAboutBlankURL[]; | |
| 24 | |
| 25 AboutFetcher(const GURL& url, const FetchCallback& loader_callback); | |
| 26 ~AboutFetcher() override; | |
| 27 | |
| 28 private: | |
| 29 void BuildResponse(); | |
| 30 | |
| 31 // Must be called exactly once to run the loader callback (asynchrously). On | |
| 32 // 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.
| |
| 33 // 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.
| |
| 34 // destroyed. | |
| 35 void PostToRunCallback(bool success); | |
| 36 | |
| 37 // shell::Fetcher implementation. | |
| 38 const GURL& GetURL() const override; | |
| 39 GURL GetRedirectURL() const override; | |
| 40 GURL GetRedirectReferer() const override; | |
| 41 URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, | |
| 42 uint32_t skip) override; | |
| 43 void AsPath( | |
| 44 base::TaskRunner* task_runner, | |
| 45 base::Callback<void(const base::FilePath&, bool)> callback) override; | |
| 46 std::string MimeType() override; | |
| 47 bool HasMojoMagic() override; | |
| 48 bool PeekFirstLine(std::string* line) override; | |
| 49 | |
| 50 const GURL url_; | |
| 51 URLResponsePtr response_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(AboutFetcher); | |
| 54 }; | |
| 55 | |
| 56 } // namespace runner | |
| 57 } // namespace mojo | |
| 58 | |
| 59 #endif // MOJO_RUNNER_ABOUT_FETCHER_H_ | |
| OLD | NEW |