Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: shell/application_manager/network_fetcher.h

Issue 1276073004: Offline By Default (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: shell/application_manager/network_fetcher.h
diff --git a/shell/application_manager/network_fetcher.h b/shell/application_manager/network_fetcher.h
index 887aa7ce3926acda439876d261ae0e97983e4f2f..4285b066ca34e70bd1ff492a22358e07e13e4a17 100644
--- a/shell/application_manager/network_fetcher.h
+++ b/shell/application_manager/network_fetcher.h
@@ -28,31 +28,12 @@ class NetworkFetcher : public Fetcher {
~NetworkFetcher() override;
private:
- // TODO(hansmuller): Revisit this when a real peek operation is available.
- static const MojoDeadline kPeekTimeout = MOJO_DEADLINE_INDEFINITE;
-
- // The network fetcher will first try to request an application from the
- // network. If that request fails, it will then try to request the application
- // from the cache.
- enum RequestType {
- FROM_NETWORK,
- FROM_CACHE,
- };
-
const GURL& GetURL() const override;
GURL GetRedirectURL() const override;
mojo::URLResponsePtr AsURLResponse(base::TaskRunner* task_runner,
uint32_t skip) override;
- static void RecordCacheToURLMapping(const base::FilePath& path,
- const GURL& url);
-
- void OnFileRetrievedFromCache(
- base::Callback<void(const base::FilePath&, bool)> callback,
- mojo::Array<uint8_t> path_as_array,
- mojo::Array<uint8_t> cache_dir);
-
void AsPath(
base::TaskRunner* task_runner,
base::Callback<void(const base::FilePath&, bool)> callback) override;
@@ -63,9 +44,26 @@ class NetworkFetcher : public Fetcher {
bool PeekFirstLine(std::string* line) override;
- void StartNetworkRequest(RequestType request_type);
+ // Returns whether the content can be loaded directly from cache. Local hosts
+ // are not loaded from cache to allow effective development.
+ bool CanLoadDirectlyFromCache();
+
+ void LoadFromCache(bool scheduleUpdate);
ppi 2015/09/16 12:32:27 Good catch with the spelling, but I meant casing -
qsr 2015/09/16 13:52:12 Done.
- void OnLoadComplete(RequestType request_type, mojo::URLResponsePtr response);
+ void OnCachedResponseReceived(bool sheduleUpdate,
+ mojo::URLResponsePtr response,
+ mojo::Array<uint8_t> path_as_array,
+ mojo::Array<uint8_t> cache_dir);
+
+ void StartNetworkRequest();
+
+ void OnLoadComplete(mojo::URLResponsePtr response);
+
+ void OnFileSavedToCache(mojo::Array<uint8_t> path_as_array,
+ mojo::Array<uint8_t> cache_dir);
+
+ static void RecordCacheToURLMapping(const base::FilePath& path,
+ const GURL& url);
const bool disable_cache_;
const GURL url_;

Powered by Google App Engine
This is Rietveld 408576698