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

Side by Side Diff: android_webview/native/aw_contents_io_thread_client_impl.h

Issue 1350553005: [Android WebView] Call shouldInterceptRequest on a background thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final version? Created 5 years, 2 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 unified diff | Download patch
OLDNEW
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/jni_weak_ref.h"
boliu 2015/09/28 23:26:28 needed only in .cc I think?
mnaganov (inactive) 2015/09/29 00:14:06 Yeah, and it's already there :)
10 #include "base/android/scoped_java_ref.h" 11 #include "base/android/scoped_java_ref.h"
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 15
15 class GURL; 16 class GURL;
16 17
17 namespace content { 18 namespace content {
18 class ResourceRequestInfo; 19 class ResourceRequestInfo;
19 class WebContents; 20 class WebContents;
(...skipping 20 matching lines...) Expand all
40 41
41 // Either |pending_associate| is true or |jclient| holds a non-null 42 // Either |pending_associate| is true or |jclient| holds a non-null
42 // Java object. 43 // Java object.
43 AwContentsIoThreadClientImpl(bool pending_associate, 44 AwContentsIoThreadClientImpl(bool pending_associate,
44 const base::android::JavaRef<jobject>& jclient); 45 const base::android::JavaRef<jobject>& jclient);
45 ~AwContentsIoThreadClientImpl() override; 46 ~AwContentsIoThreadClientImpl() override;
46 47
47 // Implementation of AwContentsIoThreadClient. 48 // Implementation of AwContentsIoThreadClient.
48 bool PendingAssociation() const override; 49 bool PendingAssociation() const override;
49 CacheMode GetCacheMode() const override; 50 CacheMode GetCacheMode() const override;
50 scoped_ptr<AwWebResourceResponse> ShouldInterceptRequest( 51 void ShouldInterceptRequestAsync(
51 const net::URLRequest* request) override; 52 const net::URLRequest* request,
53 const base::Callback<void(scoped_ptr<AwWebResourceResponse>)> callback)
54 override;
52 bool ShouldBlockContentUrls() const override; 55 bool ShouldBlockContentUrls() const override;
53 bool ShouldBlockFileUrls() const override; 56 bool ShouldBlockFileUrls() const override;
54 bool ShouldAcceptThirdPartyCookies() const override; 57 bool ShouldAcceptThirdPartyCookies() const override;
55 bool ShouldBlockNetworkLoads() const override; 58 bool ShouldBlockNetworkLoads() const override;
56 void NewDownload(const GURL& url, 59 void NewDownload(const GURL& url,
57 const std::string& user_agent, 60 const std::string& user_agent,
58 const std::string& content_disposition, 61 const std::string& content_disposition,
59 const std::string& mime_type, 62 const std::string& mime_type,
60 int64 content_length) override; 63 int64 content_length) override;
61 void NewLoginRequest(const std::string& realm, 64 void NewLoginRequest(const std::string& realm,
62 const std::string& account, 65 const std::string& account,
63 const std::string& args) override; 66 const std::string& args) override;
64 void OnReceivedError(const net::URLRequest* request) override; 67 void OnReceivedError(const net::URLRequest* request) override;
65 void OnReceivedHttpError( 68 void OnReceivedHttpError(
66 const net::URLRequest* request, 69 const net::URLRequest* request,
67 const net::HttpResponseHeaders* response_headers) override; 70 const net::HttpResponseHeaders* response_headers) override;
68 71
69 private: 72 private:
70 bool pending_association_; 73 bool pending_association_;
71 base::android::ScopedJavaGlobalRef<jobject> java_object_; 74 base::android::ScopedJavaGlobalRef<jobject> java_object_;
75 base::android::ScopedJavaGlobalRef<jobject> bg_thread_client_object_;
72 76
73 DISALLOW_COPY_AND_ASSIGN(AwContentsIoThreadClientImpl); 77 DISALLOW_COPY_AND_ASSIGN(AwContentsIoThreadClientImpl);
74 }; 78 };
75 79
76 // JNI registration method. 80 // JNI registration method.
77 bool RegisterAwContentsIoThreadClientImpl(JNIEnv* env); 81 bool RegisterAwContentsIoThreadClientImpl(JNIEnv* env);
78 82
79 } // namespace android_webview 83 } // namespace android_webview
80 84
81 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_ 85 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698