forked from chromiumembedded/java-cef
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCefRequestContext.java
More file actions
100 lines (86 loc) · 4.17 KB
/
CefRequestContext.java
File metadata and controls
100 lines (86 loc) · 4.17 KB
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
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
package org.cef.browser;
import org.cef.handler.CefRequestContextHandler;
import java.util.HashMap;
import java.util.Map;
/**
* A request context provides request handling for a set of related browser
* objects. A request context is specified when creating a new browser object
* via the CefClient.createBrowser method. Browser objects with different
* request contexts will never be hosted in the same render process. Browser
* objects with the same request context may or may not be hosted in the same
* render process depending on the process model. Browser objects created
* indirectly via the JavaScript window.open function or targeted links will
* share the same render process and the same request context as the source
* browser. When running in single-process mode there is only a single render
* process (the main process) and so all browsers created in single-process mode
* will share the same request context. This will be the first request context
* passed into the CefClient.createBrowser method and all other request
* context objects will be ignored.
*/
public abstract class CefRequestContext {
// This CTOR can't be called directly. Call method create() instead.
CefRequestContext() {}
/**
* Returns the global context object.
*/
public static final CefRequestContext getGlobalContext() {
return CefRequestContext_N.getGlobalContextNative();
}
/**
* Creates a new context object with the specified handler.
*/
public static final CefRequestContext createContext(CefRequestContextHandler handler) {
return CefRequestContext_N.createNative(handler);
}
public abstract void dispose();
/**
* Returns true if this object is the global context.
*/
public abstract boolean isGlobal();
/**
* Returns the handler for this context if any.
*/
public abstract CefRequestContextHandler getHandler();
/**
* Returns true if a preference with the specified |name| exists.
* <p>
* This method must be called on the browser process UI thread, otherwise it will always return
* false. It is easiest to ensure the correct calling thread by using a callback method invoked
* by the browser process UI thread, such as CefLifeSpanHandler.onAfterCreated(CefBrowser), to
* configure the preferences.
*/
public abstract boolean hasPreference(String name);
/**
* Returns the value for the preference with the specified |name|. Returns
* NULL if the preference does not exist.
* This method must be called on the browser process UI thread, otherwise it will always return
* null.
*/
public abstract Object getPreference(String name);
/**
* Returns all preferences as a dictionary. If |includeDefaults| is true then
* preferences currently at their default value will be included. The returned
* object can be modified but modifications will not persist. This method must
* be called on the browser process UI thread, otherwise it will always return null.
*/
public abstract Map<String, Object> getAllPreferences(boolean includeDefaults);
/**
* Returns true if the preference with the specified |name| can be modified
* using setPreference. As one example preferences set via the command-line
* usually cannot be modified. This method must be called on the browser
* process UI thread, otherwise it will always return false.
*/
public abstract boolean canSetPreference(String name);
/**
* Set the |value| associated with preference |name|. Returns null if the
* value is set successfully, an error string otherwise. If |value| is NULL the
* preference will be restored to its default value. If setting the preference
* fails then a detailed description of the problem will be returned.
* This method must be called on the browser process UI thread, otherwise it will always return
* an error string.
*/
public abstract String setPreference(String name, Object value);
}