Skip to content

Commit a6d1699

Browse files
Selim GurunAndroid (Google) Code Review
authored andcommitted
Merge "Small tidy up to getDefaultUserAgent. DO NOT MERGE" into jb-mr1-dev
2 parents b62999c + 951fcab commit a6d1699

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

core/java/android/webkit/WebSettings.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
package android.webkit;
1818

1919
import android.content.Context;
20-
import android.os.Message;
21-
import android.os.Build;
2220

2321
/**
2422
* Manages settings state for a WebView. When a WebView is first created, it
@@ -1248,7 +1246,7 @@ public synchronized String getUserAgentString() {
12481246
* @param context a Context object used to access application assets
12491247
*/
12501248
public static String getDefaultUserAgent(Context context) {
1251-
return WebView.getFactory().getDefaultUserAgent(context);
1249+
return WebViewFactory.getProvider().getStatics().getDefaultUserAgent(context);
12521250
}
12531251

12541252
/**

core/java/android/webkit/WebView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,7 @@ private void ensureProviderCreated() {
18211821
}
18221822
}
18231823

1824-
static synchronized WebViewFactoryProvider getFactory() {
1824+
private static synchronized WebViewFactoryProvider getFactory() {
18251825
// For now the main purpose of this function (and the factory abstration) is to keep
18261826
// us honest and minimize usage of WebViewClassic internals when binding the proxy.
18271827
checkThread();

core/java/android/webkit/WebViewFactoryProvider.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ interface Statics {
4242
* {@link android.webkit.WebView#disablePlatformNotifications()}
4343
*/
4444
void setPlatformNotificationsEnabled(boolean enable);
45+
46+
/**
47+
* Implements the API method:
48+
* {@link android.webkit.WebSettings#getDefaultUserAgent(Context) }
49+
*/
50+
String getDefaultUserAgent(Context context);
4551
}
4652

4753
Statics getStatics();
@@ -93,14 +99,4 @@ interface Statics {
9399
* @return the singleton WebViewDatabase instance
94100
*/
95101
WebViewDatabase getWebViewDatabase(Context context);
96-
97-
/**
98-
* Returns the default User-Agent used by a WebView.
99-
* An instance of WebView could use a different User-Agent if a call
100-
* is made to {@link WebSettings#setUserAgent(int)} or
101-
* {@link WebSettings#setUserAgentString(String)}.
102-
*
103-
* @param context a Context object used to access application assets
104-
*/
105-
String getDefaultUserAgent(Context context);
106102
}

0 commit comments

Comments
 (0)