| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_IO_THREAD_CLIENT_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_IO_THREAD_CLIENT_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_IO_THREAD_CLIENT_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_IO_THREAD_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 | 9 |
| 10 class GURL; | 10 class GURL; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // Java-side instance. It is preferable to use the static getter methods to | 27 // Java-side instance. It is preferable to use the static getter methods to |
| 28 // obtain a new instance of the class rather than holding on to one for | 28 // obtain a new instance of the class rather than holding on to one for |
| 29 // prolonged periods of time (see note for more details). | 29 // prolonged periods of time (see note for more details). |
| 30 // | 30 // |
| 31 // Note: The native AwContentsIoThreadClient instance has a Global ref to | 31 // Note: The native AwContentsIoThreadClient instance has a Global ref to |
| 32 // the Java object. By keeping the native AwContentsIoThreadClient | 32 // the Java object. By keeping the native AwContentsIoThreadClient |
| 33 // instance alive you're also prolonging the lifetime of the Java instance, so | 33 // instance alive you're also prolonging the lifetime of the Java instance, so |
| 34 // don't keep a AwContentsIoThreadClient if you don't need to. | 34 // don't keep a AwContentsIoThreadClient if you don't need to. |
| 35 class AwContentsIoThreadClient { | 35 class AwContentsIoThreadClient { |
| 36 public: | 36 public: |
| 37 // Corresponds to WebSettings cache mode constants. |
| 38 enum CacheMode { |
| 39 LOAD_DEFAULT = -1, |
| 40 LOAD_NORMAL = 0, |
| 41 LOAD_CACHE_ELSE_NETWORK = 1, |
| 42 LOAD_NO_CACHE = 2, |
| 43 LOAD_CACHE_ONLY = 3, |
| 44 }; |
| 45 |
| 37 virtual ~AwContentsIoThreadClient() {} | 46 virtual ~AwContentsIoThreadClient() {} |
| 38 | 47 |
| 48 // Retrieve CacheMode setting value of this AwContents. |
| 49 // This method is called on the IO thread only. |
| 50 virtual CacheMode GetCacheMode() const = 0; |
| 51 |
| 39 // This will attempt to fetch the AwContentsIoThreadClient for the given | 52 // This will attempt to fetch the AwContentsIoThreadClient for the given |
| 40 // |render_process_id|, |render_view_id| pair. | 53 // |render_process_id|, |render_view_id| pair. |
| 41 // This method can be called from any thread. | 54 // This method can be called from any thread. |
| 42 // An empty scoped_ptr is a valid return value. | 55 // An empty scoped_ptr is a valid return value. |
| 43 static scoped_ptr<AwContentsIoThreadClient> FromID(int render_process_id, | 56 static scoped_ptr<AwContentsIoThreadClient> FromID(int render_process_id, |
| 44 int render_view_id); | 57 int render_view_id); |
| 45 | 58 |
| 46 // This method is called on the IO thread only. | 59 // This method is called on the IO thread only. |
| 47 virtual scoped_ptr<InterceptedRequestData> ShouldInterceptRequest( | 60 virtual scoped_ptr<InterceptedRequestData> ShouldInterceptRequest( |
| 48 const GURL& location, | 61 const GURL& location, |
| 49 const net::URLRequest* request) = 0; | 62 const net::URLRequest* request) = 0; |
| 50 | 63 |
| 51 // Retrieve the AllowContentAccess setting value of this AwContents. | 64 // Retrieve the AllowContentAccess setting value of this AwContents. |
| 52 // This method is called on the IO thread only. | 65 // This method is called on the IO thread only. |
| 53 virtual bool ShouldBlockContentUrls() const = 0; | 66 virtual bool ShouldBlockContentUrls() const = 0; |
| 54 | 67 |
| 55 // Retrieve the AllowFileAccess setting value of this AwContents. | 68 // Retrieve the AllowFileAccess setting value of this AwContents. |
| 56 // This method is called on the IO thread only. | 69 // This method is called on the IO thread only. |
| 57 virtual bool ShouldBlockFileUrls() const = 0; | 70 virtual bool ShouldBlockFileUrls() const = 0; |
| 58 | 71 |
| 59 // Retrieve the BlockNetworkLoads setting value of this AwContents. | 72 // Retrieve the BlockNetworkLoads setting value of this AwContents. |
| 60 // This method is called on the IO thread only. | 73 // This method is called on the IO thread only. |
| 61 virtual bool ShouldBlockNetworkLoads() const = 0; | 74 virtual bool ShouldBlockNetworkLoads() const = 0; |
| 62 }; | 75 }; |
| 63 | 76 |
| 64 } // namespace android_webview | 77 } // namespace android_webview |
| 65 | 78 |
| 66 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_IO_THREAD_CLIENT_H_ | 79 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_IO_THREAD_CLIENT_H_ |
| OLD | NEW |