forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaw_contents_io_thread_client_impl.h
89 lines (71 loc) · 3.2 KB
/
aw_contents_io_thread_client_impl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_
#define ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_
#include <stdint.h>
#include "android_webview/browser/aw_contents_io_thread_client.h"
#include "base/android/scoped_java_ref.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
class GURL;
namespace content {
class ResourceRequestInfo;
class WebContents;
}
namespace net {
class URLRequest;
}
namespace android_webview {
class AwWebResourceResponse;
class AwContentsIoThreadClientImpl : public AwContentsIoThreadClient {
public:
// Called when AwContents is created before there is a Java client.
static void RegisterPendingContents(content::WebContents* web_contents);
// Associates the |jclient| instance (which must implement the
// AwContentsIoThreadClient Java interface) with the |web_contents|.
// This should be called at most once per |web_contents|.
static void Associate(content::WebContents* web_contents,
const base::android::JavaRef<jobject>& jclient);
// Sets the |jclient| java instance to which service worker related
// callbacks should be delegated.
static void SetServiceWorkerIoThreadClient(
const base::android::JavaRef<jobject>& jclient,
const base::android::JavaRef<jobject>& browser_context);
// Either |pending_associate| is true or |jclient| holds a non-null
// Java object.
AwContentsIoThreadClientImpl(bool pending_associate,
const base::android::JavaRef<jobject>& jclient);
~AwContentsIoThreadClientImpl() override;
// Implementation of AwContentsIoThreadClient.
bool PendingAssociation() const override;
CacheMode GetCacheMode() const override;
void ShouldInterceptRequestAsync(
const net::URLRequest* request,
const ShouldInterceptRequestResultCallback callback) override;
bool ShouldBlockContentUrls() const override;
bool ShouldBlockFileUrls() const override;
bool ShouldAcceptThirdPartyCookies() const override;
bool ShouldBlockNetworkLoads() const override;
void NewDownload(const GURL& url,
const std::string& user_agent,
const std::string& content_disposition,
const std::string& mime_type,
int64_t content_length) override;
void NewLoginRequest(const std::string& realm,
const std::string& account,
const std::string& args) override;
void OnReceivedError(const net::URLRequest* request) override;
void OnReceivedHttpError(
const net::URLRequest* request,
const net::HttpResponseHeaders* response_headers) override;
private:
bool pending_association_;
base::android::ScopedJavaGlobalRef<jobject> java_object_;
base::android::ScopedJavaGlobalRef<jobject> bg_thread_client_object_;
DISALLOW_COPY_AND_ASSIGN(AwContentsIoThreadClientImpl);
};
// JNI registration method.
bool RegisterAwContentsIoThreadClientImpl(JNIEnv* env);
} // namespace android_webview
#endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_