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

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: Add missing explicits. 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
« no previous file with comments | « shell/application_manager/local_fetcher.cc ('k') | shell/application_manager/network_fetcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9f1d45556ee3b409ef29725d56c537fc1d8c2cf4 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 schedule_update);
- void OnLoadComplete(RequestType request_type, mojo::URLResponsePtr response);
+ void OnCachedResponseReceived(bool schedule_update,
+ 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_;
« no previous file with comments | « shell/application_manager/local_fetcher.cc ('k') | shell/application_manager/network_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698