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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
android_webview / browser / prefetch / aw_prefetch_service_delegate.cc [blame]
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "android_webview/browser/prefetch/aw_prefetch_service_delegate.h"
#include "android_webview/browser/aw_browser_context.h"
#include "base/notreached.h"
namespace android_webview {
AwPrefetchServiceDelegate::AwPrefetchServiceDelegate(
AwBrowserContext* browser_context)
: browser_context_(*browser_context) {}
AwPrefetchServiceDelegate::~AwPrefetchServiceDelegate() = default;
std::string AwPrefetchServiceDelegate::GetMajorVersionNumber() {
NOTREACHED() << "Only used for isolated network context. WebView doesn't use "
"an isolated network context for app triggered prefetching.";
}
std::string AwPrefetchServiceDelegate::GetAcceptLanguageHeader() {
NOTREACHED() << "Only used for isolated network context. WebView doesn't use "
"an isolated network context for app triggered prefetching.";
}
GURL AwPrefetchServiceDelegate::GetDefaultPrefetchProxyHost() {
// Used for prefetch proxy config (which is always constructed). WebView
// doesn't use a proxy for app triggered prefetching. If WebView ever adds
// support for non-app triggered prefetching, we may need to revisit the value
// returned here.
return GURL("");
}
std::string AwPrefetchServiceDelegate::GetAPIKey() {
// Used for prefetch proxy config (which is always constructed). WebView
// doesn't use a proxy for app triggered prefetching. If WebView ever adds
// support for non-app triggered prefetching, we may need to revisit the value
// returned here.
return "";
}
GURL AwPrefetchServiceDelegate::GetDefaultDNSCanaryCheckURL() {
// Used for prefetch proxy config (which is always constructed). WebView
// doesn't use a proxy for app triggered prefetching. If WebView ever adds
// support for non-app triggered prefetching, we may need to revisit the value
// returned here.
return GURL("");
}
GURL AwPrefetchServiceDelegate::GetDefaultTLSCanaryCheckURL() {
// Used for prefetch proxy config (which is always constructed). WebView
// doesn't use a proxy for app triggered prefetching. If WebView ever adds
// support for non-app triggered prefetching, we may need to revisit the value
// returned here.
return GURL("");
}
void AwPrefetchServiceDelegate::ReportOriginRetryAfter(
const GURL& url,
base::TimeDelta retry_after) {
// TODO (crbug.com/369313220) : Implement retry-after logic.
}
bool AwPrefetchServiceDelegate::IsOriginOutsideRetryAfterWindow(
const GURL& url) {
// TODO (crbug.com/369313220) : Implement retry-after logic.
return true;
}
void AwPrefetchServiceDelegate::ClearData() {
// TODO (crbug.com/369313220) : Implement retry-after logic.
}
bool AwPrefetchServiceDelegate::DisableDecoysBasedOnUserSettings() {
// Decoys are not supported within app-triggered prefetching.
// However, if WebView ever adds support for non-app triggered prefetching, we
// may need to revisit the value returned here.
return true;
}
content::PreloadingEligibility
AwPrefetchServiceDelegate::IsSomePreloadingEnabled() {
// Prefetching within WebView is currently only app-triggered so by default we
// return |PreloadingEligibility::kEligible|. However, if WebView ever adds
// support for non-app triggered prefetching, we may need to revisit the value
// returned here.
return content::PreloadingEligibility::kEligible;
}
bool AwPrefetchServiceDelegate::IsPreloadingPrefEnabled() {
// This flag is not used within app triggered prefetching (which is the only
// prefetching WebView currently supports). However, if WebView ever adds
// support for non-app triggered prefetching, we may need to revisit the value
// returned here.
return false;
}
bool AwPrefetchServiceDelegate::IsDataSaverEnabled() {
// Data saver is not considered within app triggered prefetching (which is the
// only prefetching WebView currently supports). However, if WebView ever adds
// support for non-app triggered prefetching, we may need to revisit the value
// returned here.
return false;
}
bool AwPrefetchServiceDelegate::IsBatterySaverEnabled() {
// Battery saver is not considered within app triggered prefetching (which is
// the only prefetching WebView currently supports). However, if WebView ever
// adds support for non-app triggered prefetching, we may need to revisit the
// value returned here.
return false;
}
bool AwPrefetchServiceDelegate::IsExtendedPreloadingEnabled() {
// WebView app initiated prefetching does no support extended preloading.
// However, if WebView ever adds support for non-app triggered prefetching, we
// may need to revisit the value returned here.
return false;
}
bool AwPrefetchServiceDelegate::IsDomainInPrefetchAllowList(
const GURL& referring_url) {
// WebView app initiated prefetching does not use prefetch allow lists.
// However, if WebView ever adds support for non-app triggered prefetching, we
// may need to revisit the value returned here.
return false;
}
bool AwPrefetchServiceDelegate::IsContaminationExempt(
const GURL& referring_url) {
// WebView app initiated prefetching does not use an isolated network context.
// However, if WebView ever adds support for non-app triggered prefetching, we
// may need to revisit the value returned here.
return false;
}
void AwPrefetchServiceDelegate::OnPrefetchLikely(
content::WebContents* web_contents) {
// Only used for renderer initiated prefetching which WebView doesn't
// currently support.
}
} // namespace android_webview