OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_ | |
6 #define ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "android_webview/browser/aw_contents_io_thread_client.h" | |
11 #include "base/android/scoped_java_ref.h" | |
12 #include "base/compiler_specific.h" | |
13 #include "base/macros.h" | |
14 | |
15 namespace content { | |
16 class WebContents; | |
17 } | |
18 | |
19 namespace net { | |
20 class URLRequest; | |
21 } | |
22 | |
23 namespace android_webview { | |
24 | |
25 class AwContentsIoThreadClientImpl : public AwContentsIoThreadClient { | |
26 public: | |
27 // Called when AwContents is created before there is a Java client. | |
28 static void RegisterPendingContents(content::WebContents* web_contents); | |
29 | |
30 // Associates the |jclient| instance (which must implement the | |
31 // AwContentsIoThreadClient Java interface) with the |web_contents|. | |
32 // This should be called at most once per |web_contents|. | |
33 static void Associate(content::WebContents* web_contents, | |
34 const base::android::JavaRef<jobject>& jclient); | |
35 | |
36 // Sets the |jclient| java instance to which service worker related | |
37 // callbacks should be delegated. | |
38 static void SetServiceWorkerIoThreadClient( | |
39 const base::android::JavaRef<jobject>& jclient, | |
40 const base::android::JavaRef<jobject>& browser_context); | |
41 | |
42 // Either |pending_associate| is true or |jclient| holds a non-null | |
43 // Java object. | |
44 AwContentsIoThreadClientImpl(bool pending_associate, | |
45 const base::android::JavaRef<jobject>& jclient); | |
46 ~AwContentsIoThreadClientImpl() override; | |
47 | |
48 // Implementation of AwContentsIoThreadClient. | |
49 bool PendingAssociation() const override; | |
50 CacheMode GetCacheMode() const override; | |
51 void ShouldInterceptRequestAsync( | |
52 const net::URLRequest* request, | |
53 const ShouldInterceptRequestResultCallback callback) override; | |
54 bool ShouldBlockContentUrls() const override; | |
55 bool ShouldBlockFileUrls() const override; | |
56 bool ShouldAcceptThirdPartyCookies() const override; | |
57 bool GetSafeBrowsingEnabled() const override; | |
58 bool ShouldBlockNetworkLoads() const override; | |
59 | |
60 private: | |
61 bool pending_association_; | |
62 base::android::ScopedJavaGlobalRef<jobject> java_object_; | |
63 base::android::ScopedJavaGlobalRef<jobject> bg_thread_client_object_; | |
64 | |
65 DISALLOW_COPY_AND_ASSIGN(AwContentsIoThreadClientImpl); | |
66 }; | |
67 | |
68 } // namespace android_webview | |
69 | |
70 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_ | |
OLD | NEW |