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

Unified Diff: services/url_response_disk_cache/url_response_disk_cache_delegate.h

Issue 1364243002: Bundle core applicatons in the shell. (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: services/url_response_disk_cache/url_response_disk_cache_delegate.h
diff --git a/services/url_response_disk_cache/url_response_disk_cache_delegate.h b/services/url_response_disk_cache/url_response_disk_cache_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..5f8777c46fd7ae23bc7c60b945c99b219a0f6245
--- /dev/null
+++ b/services/url_response_disk_cache/url_response_disk_cache_delegate.h
@@ -0,0 +1,39 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_URL_RESPONSE_DISK_CACHE_URL_RESPONSE_DISK_CACHE_DELEGATE_H_
+#define SERVICES_URL_RESPONSE_DISK_CACHE_URL_RESPONSE_DISK_CACHE_DELEGATE_H_
+
+#include "base/callback.h"
+#include "base/files/file_path.h"
+#include "base/task_runner.h"
+
+namespace mojo {
+
+// This class allows to customized the behavior of the |URLResponseDiskCache|
+// implementation.
+class URLResponseDiskCacheDelegate {
+ public:
+ URLResponseDiskCacheDelegate() {}
+ virtual ~URLResponseDiskCacheDelegate() {}
+
+ // Allows to prefill the cache with content. This method will be called by the
+ // cache when an item that has never been in the cache is requested.
+ // |task_runner| is a task runner that can be used to do I/O. |url| is the url
+ // of the entry. |target| is a path where the content must be copied to if it
+ // exists. |callback| must be called with |true| if the delegate can retrieve
+ // an initial content for |url| after having push the content to |target|,
+ // otherwise, |callback| must be called with |false|. |callback| can be called
+ // before this method returns.
+ virtual void GetInitialPath(scoped_refptr<base::TaskRunner> task_runner,
+ const std::string& url,
+ const base::FilePath& target,
+ const base::Callback<void(bool)>& callback) = 0;
+
+ DISALLOW_COPY_AND_ASSIGN(URLResponseDiskCacheDelegate);
+};
+
+} // namespace mojo
+
+#endif // SERVICES_URL_RESPONSE_DISK_CACHE_URL_RESPONSE_DISK_CACHE_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698