Small tidy up to getDefaultUserAgent. DO NOT MERGE
- no need for WebSettings to bounce via WebView to get to the factory
- move this static (non-factory) method into the Statics inner class.
Bug: 6329117
Clean cherry pick: d1c4faa5a4
Change-Id: I96807df0171c7308421ca8811cfcb1bf710cb007
This commit is contained in:
committed by
Selim Gurun
parent
df5c3a54c7
commit
951fcabef6
@@ -17,8 +17,6 @@
|
||||
package android.webkit;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Message;
|
||||
import android.os.Build;
|
||||
|
||||
/**
|
||||
* Manages settings state for a WebView. When a WebView is first created, it
|
||||
@@ -1235,7 +1233,7 @@ public abstract class WebSettings {
|
||||
* @param context a Context object used to access application assets
|
||||
*/
|
||||
public static String getDefaultUserAgent(Context context) {
|
||||
return WebView.getFactory().getDefaultUserAgent(context);
|
||||
return WebViewFactory.getProvider().getStatics().getDefaultUserAgent(context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1821,7 +1821,7 @@ public class WebView extends AbsoluteLayout
|
||||
}
|
||||
}
|
||||
|
||||
static synchronized WebViewFactoryProvider getFactory() {
|
||||
private static synchronized WebViewFactoryProvider getFactory() {
|
||||
// For now the main purpose of this function (and the factory abstration) is to keep
|
||||
// us honest and minimize usage of WebViewClassic internals when binding the proxy.
|
||||
checkThread();
|
||||
|
||||
@@ -42,6 +42,12 @@ public interface WebViewFactoryProvider {
|
||||
* {@link android.webkit.WebView#disablePlatformNotifications()}
|
||||
*/
|
||||
void setPlatformNotificationsEnabled(boolean enable);
|
||||
|
||||
/**
|
||||
* Implements the API method:
|
||||
* {@link android.webkit.WebSettings#getDefaultUserAgent(Context) }
|
||||
*/
|
||||
String getDefaultUserAgent(Context context);
|
||||
}
|
||||
|
||||
Statics getStatics();
|
||||
@@ -93,14 +99,4 @@ public interface WebViewFactoryProvider {
|
||||
* @return the singleton WebViewDatabase instance
|
||||
*/
|
||||
WebViewDatabase getWebViewDatabase(Context context);
|
||||
|
||||
/**
|
||||
* Returns the default User-Agent used by a WebView.
|
||||
* An instance of WebView could use a different User-Agent if a call
|
||||
* is made to {@link WebSettings#setUserAgent(int)} or
|
||||
* {@link WebSettings#setUserAgentString(String)}.
|
||||
*
|
||||
* @param context a Context object used to access application assets
|
||||
*/
|
||||
String getDefaultUserAgent(Context context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user