| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_SHELL_FETCHER_H_ | 5 #ifndef MOJO_SHELL_FETCHER_H_ |
| 6 #define MOJO_SHELL_FETCHER_H_ | 6 #define MOJO_SHELL_FETCHER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 Fetcher(const FetchCallback& fetch_callback); | 40 Fetcher(const FetchCallback& fetch_callback); |
| 41 virtual ~Fetcher(); | 41 virtual ~Fetcher(); |
| 42 | 42 |
| 43 // Returns the original URL that was fetched. | 43 // Returns the original URL that was fetched. |
| 44 virtual const GURL& GetURL() const = 0; | 44 virtual const GURL& GetURL() const = 0; |
| 45 | 45 |
| 46 // If the fetch resulted in a redirect, this returns the final URL after all | 46 // If the fetch resulted in a redirect, this returns the final URL after all |
| 47 // redirects. Otherwise, it returns an empty URL. | 47 // redirects. Otherwise, it returns an empty URL. |
| 48 virtual GURL GetRedirectURL() const = 0; | 48 virtual GURL GetRedirectURL() const = 0; |
| 49 | 49 |
| 50 // If the fetch resulted in a redirect, this returns the referer URL to use |
| 51 // with the redirect. |
| 52 virtual GURL GetRedirectReferer() const = 0; |
| 53 |
| 50 virtual URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, | 54 virtual URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, |
| 51 uint32_t skip) = 0; | 55 uint32_t skip) = 0; |
| 52 | 56 |
| 53 virtual void AsPath( | 57 virtual void AsPath( |
| 54 base::TaskRunner* task_runner, | 58 base::TaskRunner* task_runner, |
| 55 base::Callback<void(const base::FilePath&, bool)> callback) = 0; | 59 base::Callback<void(const base::FilePath&, bool)> callback) = 0; |
| 56 | 60 |
| 57 virtual std::string MimeType() = 0; | 61 virtual std::string MimeType() = 0; |
| 58 | 62 |
| 59 virtual bool HasMojoMagic() = 0; | 63 virtual bool HasMojoMagic() = 0; |
| 60 | 64 |
| 61 virtual bool PeekFirstLine(std::string* line) = 0; | 65 virtual bool PeekFirstLine(std::string* line) = 0; |
| 62 | 66 |
| 63 bool PeekContentHandler(std::string* mojo_shebang, | 67 bool PeekContentHandler(std::string* mojo_shebang, |
| 64 GURL* mojo_content_handler_url); | 68 GURL* mojo_content_handler_url); |
| 65 | 69 |
| 66 protected: | 70 protected: |
| 67 static const char kMojoMagic[]; | 71 static const char kMojoMagic[]; |
| 68 static const size_t kMaxShebangLength; | 72 static const size_t kMaxShebangLength; |
| 69 | 73 |
| 70 FetchCallback loader_callback_; | 74 FetchCallback loader_callback_; |
| 71 }; | 75 }; |
| 72 | 76 |
| 73 } // namespace shell | 77 } // namespace shell |
| 74 } // namespace mojo | 78 } // namespace mojo |
| 75 | 79 |
| 76 #endif // MOJO_SHELL_FETCHER_H_ | 80 #endif // MOJO_SHELL_FETCHER_H_ |
| OLD | NEW |