| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 WEBKIT_APPCACHE_APPCACHE_POLICY_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_POLICY_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_POLICY_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_POLICY_H_ |
| 7 | 7 |
| 8 #include "net/base/completion_callback.h" | |
| 9 | |
| 10 class GURL; | 8 class GURL; |
| 11 | 9 |
| 12 namespace appcache { | 10 namespace appcache { |
| 13 | 11 |
| 14 class AppCachePolicy { | 12 class AppCachePolicy { |
| 15 public: | 13 public: |
| 16 AppCachePolicy() {} | 14 AppCachePolicy() {} |
| 17 | 15 |
| 18 // Called prior to loading a main resource from the appache. | 16 // Called prior to loading a main resource from the appache. |
| 19 // Returns true if allowed. This is expected to return immediately | 17 // Returns true if allowed. This is expected to return immediately |
| 20 // without any user prompt. | 18 // without any user prompt. |
| 21 virtual bool CanLoadAppCache(const GURL& manifest_url) = 0; | 19 virtual bool CanLoadAppCache(const GURL& manifest_url, |
| 20 const GURL& first_party) = 0; |
| 22 | 21 |
| 23 // Called prior to creating a new appcache. | 22 // Called prior to creating a new appcache. Returns true if allowed. |
| 24 // Returns net::OK if allowed, net::ERR_ACCESS_DENIED if not allowed. | 23 virtual bool CanCreateAppCache(const GURL& manifest_url, |
| 25 // May also return net::ERR_IO_PENDING to indicate | 24 const GURL& first_party) = 0; |
| 26 // that the completion callback will be notified (asynchronously and on | |
| 27 // the current thread) of the final result. Note: The completion callback | |
| 28 // must remain valid until notified. | |
| 29 virtual int CanCreateAppCache(const GURL& manifest_url, | |
| 30 net::CompletionCallback* callback) = 0; | |
| 31 | 25 |
| 32 protected: | 26 protected: |
| 33 ~AppCachePolicy() {} | 27 ~AppCachePolicy() {} |
| 34 }; | 28 }; |
| 35 | 29 |
| 36 } // namespace appcache | 30 } // namespace appcache |
| 37 | 31 |
| 38 #endif // WEBKIT_APPCACHE_APPCACHE_POLICY_H_ | 32 #endif // WEBKIT_APPCACHE_APPCACHE_POLICY_H_ |
| OLD | NEW |