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_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_ | 5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_ |
6 #define ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_ | 6 #define ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_ |
7 | 7 |
8 #include "android_webview/browser/aw_contents_io_thread_client.h" | 8 #include "android_webview/browser/aw_contents_io_thread_client.h" |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 | 14 |
15 class GURL; | 15 class GURL; |
16 | 16 |
17 namespace content { | 17 namespace content { |
| 18 class ResourceRequestInfo; |
18 class WebContents; | 19 class WebContents; |
19 } | 20 } |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 class URLRequest; | 23 class URLRequest; |
23 } | 24 } |
24 | 25 |
25 namespace android_webview { | 26 namespace android_webview { |
26 | 27 |
27 class InterceptedRequestData; | 28 class AwWebResourceResponse; |
28 | 29 |
29 class AwContentsIoThreadClientImpl : public AwContentsIoThreadClient { | 30 class AwContentsIoThreadClientImpl : public AwContentsIoThreadClient { |
30 public: | 31 public: |
31 // Called when AwContents is created before there is a Java client. | 32 // Called when AwContents is created before there is a Java client. |
32 static void RegisterPendingContents(content::WebContents* web_contents); | 33 static void RegisterPendingContents(content::WebContents* web_contents); |
33 | 34 |
34 // Associates the |jclient| instance (which must implement the | 35 // Associates the |jclient| instance (which must implement the |
35 // AwContentsIoThreadClient Java interface) with the |web_contents|. | 36 // AwContentsIoThreadClient Java interface) with the |web_contents|. |
36 // This should be called at most once per |web_contents|. | 37 // This should be called at most once per |web_contents|. |
37 static void Associate(content::WebContents* web_contents, | 38 static void Associate(content::WebContents* web_contents, |
38 const base::android::JavaRef<jobject>& jclient); | 39 const base::android::JavaRef<jobject>& jclient); |
39 | 40 |
40 // Either |pending_associate| is true or |jclient| holds a non-null | 41 // Either |pending_associate| is true or |jclient| holds a non-null |
41 // Java object. | 42 // Java object. |
42 AwContentsIoThreadClientImpl(bool pending_associate, | 43 AwContentsIoThreadClientImpl(bool pending_associate, |
43 const base::android::JavaRef<jobject>& jclient); | 44 const base::android::JavaRef<jobject>& jclient); |
44 virtual ~AwContentsIoThreadClientImpl() OVERRIDE; | 45 virtual ~AwContentsIoThreadClientImpl() OVERRIDE; |
45 | 46 |
46 // Implementation of AwContentsIoThreadClient. | 47 // Implementation of AwContentsIoThreadClient. |
47 virtual bool PendingAssociation() const OVERRIDE; | 48 virtual bool PendingAssociation() const OVERRIDE; |
48 virtual CacheMode GetCacheMode() const OVERRIDE; | 49 virtual CacheMode GetCacheMode() const OVERRIDE; |
49 virtual scoped_ptr<InterceptedRequestData> ShouldInterceptRequest( | 50 virtual scoped_ptr<AwWebResourceResponse> ShouldInterceptRequest( |
50 const GURL& location, | 51 const GURL& location, |
51 const net::URLRequest* request) OVERRIDE; | 52 const net::URLRequest* request) OVERRIDE; |
52 virtual bool ShouldBlockContentUrls() const OVERRIDE; | 53 virtual bool ShouldBlockContentUrls() const OVERRIDE; |
53 virtual bool ShouldBlockFileUrls() const OVERRIDE; | 54 virtual bool ShouldBlockFileUrls() const OVERRIDE; |
54 virtual bool ShouldAcceptThirdPartyCookies() const OVERRIDE; | 55 virtual bool ShouldAcceptThirdPartyCookies() const OVERRIDE; |
55 virtual bool ShouldBlockNetworkLoads() const OVERRIDE; | 56 virtual bool ShouldBlockNetworkLoads() const OVERRIDE; |
56 virtual void NewDownload(const GURL& url, | 57 virtual void NewDownload(const GURL& url, |
57 const std::string& user_agent, | 58 const std::string& user_agent, |
58 const std::string& content_disposition, | 59 const std::string& content_disposition, |
59 const std::string& mime_type, | 60 const std::string& mime_type, |
60 int64 content_length) OVERRIDE; | 61 int64 content_length) OVERRIDE; |
61 virtual void NewLoginRequest(const std::string& realm, | 62 virtual void NewLoginRequest(const std::string& realm, |
62 const std::string& account, | 63 const std::string& account, |
63 const std::string& args) OVERRIDE; | 64 const std::string& args) OVERRIDE; |
64 | 65 |
65 private: | 66 private: |
66 bool pending_association_; | 67 bool pending_association_; |
67 base::android::ScopedJavaGlobalRef<jobject> java_object_; | 68 base::android::ScopedJavaGlobalRef<jobject> java_object_; |
68 | 69 |
69 DISALLOW_COPY_AND_ASSIGN(AwContentsIoThreadClientImpl); | 70 DISALLOW_COPY_AND_ASSIGN(AwContentsIoThreadClientImpl); |
70 }; | 71 }; |
71 | 72 |
72 // JNI registration method. | 73 // JNI registration method. |
73 bool RegisterAwContentsIoThreadClientImpl(JNIEnv* env); | 74 bool RegisterAwContentsIoThreadClientImpl(JNIEnv* env); |
74 | 75 |
75 } // namespace android_webview | 76 } // namespace android_webview |
76 | 77 |
77 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_ | 78 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_ |
OLD | NEW |