Chromium Code Reviews| 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 SHELL_APPLICATION_MANAGER_FETCHER_H_ | 5 #ifndef SHELL_APPLICATION_MANAGER_FETCHER_H_ |
| 6 #define SHELL_APPLICATION_MANAGER_FETCHER_H_ | 6 #define SHELL_APPLICATION_MANAGER_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 22 matching lines...) Expand all Loading... | |
| 33 public: | 33 public: |
| 34 // The param will be NULL in the case where the content could not be fetched. | 34 // The param will be NULL in the case where the content could not be fetched. |
| 35 // Reasons include: | 35 // Reasons include: |
| 36 // - network error | 36 // - network error |
| 37 // - 4x or 5x HTTP errors | 37 // - 4x or 5x HTTP errors |
| 38 typedef base::Callback<void(scoped_ptr<Fetcher>)> FetchCallback; | 38 typedef base::Callback<void(scoped_ptr<Fetcher>)> FetchCallback; |
| 39 | 39 |
| 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. | |
|
DaveMoore
2015/02/24 20:42:59
Wouldn't it be better to just have one method on f
Aaron Boodman
2015/02/24 21:48:25
Whether a redirect happened is important informati
| |
| 44 virtual const GURL& GetURL() const = 0; | |
| 45 | |
| 46 // If the fetch resulted in a redirect, this returns the final URL after all | |
| 47 // redirects. Otherwise, it returns an empty URL. | |
| 48 virtual GURL GetRedirectURL() const = 0; | |
| 49 | |
| 43 virtual URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, | 50 virtual URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, |
| 44 uint32_t skip) = 0; | 51 uint32_t skip) = 0; |
| 45 | 52 |
| 46 virtual void AsPath( | 53 virtual void AsPath( |
| 47 base::TaskRunner* task_runner, | 54 base::TaskRunner* task_runner, |
| 48 base::Callback<void(const base::FilePath&, bool)> callback) = 0; | 55 base::Callback<void(const base::FilePath&, bool)> callback) = 0; |
| 49 | 56 |
| 50 virtual std::string MimeType() = 0; | 57 virtual std::string MimeType() = 0; |
| 51 | 58 |
| 52 virtual bool HasMojoMagic() = 0; | 59 virtual bool HasMojoMagic() = 0; |
| 53 | 60 |
| 54 virtual bool PeekFirstLine(std::string* line) = 0; | 61 virtual bool PeekFirstLine(std::string* line) = 0; |
| 55 | 62 |
| 56 bool PeekContentHandler(std::string* mojo_shebang, | 63 bool PeekContentHandler(std::string* mojo_shebang, |
| 57 GURL* mojo_content_handler_url); | 64 GURL* mojo_content_handler_url); |
| 58 | 65 |
| 59 protected: | 66 protected: |
| 60 static const char kMojoMagic[]; | 67 static const char kMojoMagic[]; |
| 61 static const size_t kMaxShebangLength; | 68 static const size_t kMaxShebangLength; |
| 62 | 69 |
| 63 FetchCallback loader_callback_; | 70 FetchCallback loader_callback_; |
| 64 }; | 71 }; |
| 65 | 72 |
| 66 } // namespace mojo | 73 } // namespace mojo |
| 67 | 74 |
| 68 #endif // SHELL_APPLICATION_MANAGER_FETCHER_H_ | 75 #endif // SHELL_APPLICATION_MANAGER_FETCHER_H_ |
| OLD | NEW |