Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: android_webview/glue/java/src/com/android/webview/chromium/WebViewDelegateFactory.java

Issue 2645413002: Prepare to get the multiprocess setting from WebViewDelegate. (Closed)
Patch Set: Move version condition logic back to FactoryProvider Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package com.android.webview.chromium; 5 package com.android.webview.chromium;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.app.Application; 8 import android.app.Application;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.ContextWrapper; 10 import android.content.ContextWrapper;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 int getPackageId(Resources resources, String packageName); 75 int getPackageId(Resources resources, String packageName);
76 76
77 /** @see android.webkit.WebViewDelegate#getApplication */ 77 /** @see android.webkit.WebViewDelegate#getApplication */
78 Application getApplication(); 78 Application getApplication();
79 79
80 /** @see android.webkit.WebViewDelegate#getErrorString */ 80 /** @see android.webkit.WebViewDelegate#getErrorString */
81 String getErrorString(Context context, int errorCode); 81 String getErrorString(Context context, int errorCode);
82 82
83 /** @see android.webkit.WebViewDelegate#addWebViewAssetPath */ 83 /** @see android.webkit.WebViewDelegate#addWebViewAssetPath */
84 void addWebViewAssetPath(Context context); 84 void addWebViewAssetPath(Context context);
85
86 /** @see android.webkit.WebViewDelegate#isMultiProcessEnabled */
87 boolean isMultiProcessEnabled();
85 } 88 }
86 89
87 /** 90 /**
88 * Creates a {@link WebViewDelegate com.android.webview.chromium.WebViewDele gate} that proxies 91 * Creates a {@link WebViewDelegate com.android.webview.chromium.WebViewDele gate} that proxies
89 * requests to the given {@link android.webkit.WebViewDelegate android.webki t.WebViewDelegate}. 92 * requests to the given {@link android.webkit.WebViewDelegate android.webki t.WebViewDelegate}.
90 * 93 *
91 * @return the created delegate 94 * @return the created delegate
92 */ 95 */
93 static WebViewDelegate createProxyDelegate(android.webkit.WebViewDelegate de legate) { 96 static WebViewDelegate createProxyDelegate(android.webkit.WebViewDelegate de legate) {
94 return new ProxyDelegate(delegate); 97 return new ProxyDelegate(delegate);
95 } 98 }
96 99
97 /** 100 /**
98 * Creates a {@link WebViewDelegate com.android.webview.chromium.WebViewDele gate} compatible 101 * Creates a {@link WebViewDelegate com.android.webview.chromium.WebViewDele gate} compatible
99 * with the API 21 version of the framework in which 102 * with the API 21 version of the framework in which
100 * {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate} had not yet been 103 * {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate} had not yet been
101 * introduced. 104 * introduced.
102 * 105 *
103 * @return the created delegate 106 * @return the created delegate
104 */ 107 */
105 static WebViewDelegate createApi21CompatibilityDelegate() { 108 static WebViewDelegate createApi21CompatibilityDelegate() {
106 return new Api21CompatibilityDelegate(); 109 return new Api21CompatibilityDelegate();
107 } 110 }
108 111
109 /** 112 /**
110 * A {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} th at proxies requests 113 * A {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} th at proxies requests
111 * to a {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate }. 114 * to a {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate }.
112 */ 115 */
113 private static class ProxyDelegate implements WebViewDelegate { 116 static class ProxyDelegate implements WebViewDelegate {
114 android.webkit.WebViewDelegate mDelegate; 117 android.webkit.WebViewDelegate mDelegate;
115 118
116 ProxyDelegate(android.webkit.WebViewDelegate delegate) { 119 ProxyDelegate(android.webkit.WebViewDelegate delegate) {
117 mDelegate = delegate; 120 mDelegate = delegate;
118 } 121 }
119 122
120 @Override 123 @Override
121 public void setOnTraceEnabledChangeListener(final OnTraceEnabledChangeLi stener listener) { 124 public void setOnTraceEnabledChangeListener(final OnTraceEnabledChangeLi stener listener) {
122 mDelegate.setOnTraceEnabledChangeListener( 125 mDelegate.setOnTraceEnabledChangeListener(
123 new android.webkit.WebViewDelegate.OnTraceEnabledChangeListe ner() { 126 new android.webkit.WebViewDelegate.OnTraceEnabledChangeListe ner() {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // wrapper here here to avoid calling the getAssets() 194 // wrapper here here to avoid calling the getAssets()
192 // proxy chain (which we cannot change because it is in 195 // proxy chain (which we cannot change because it is in
193 // WebView framework code). 196 // WebView framework code).
194 mDelegate.addWebViewAssetPath(new ContextWrapper(context) { 197 mDelegate.addWebViewAssetPath(new ContextWrapper(context) {
195 @Override 198 @Override
196 public AssetManager getAssets() { 199 public AssetManager getAssets() {
197 return getResources().getAssets(); 200 return getResources().getAssets();
198 } 201 }
199 }); 202 });
200 } 203 }
204
205 @Override
206 public boolean isMultiProcessEnabled() {
207 throw new UnsupportedOperationException();
208 }
201 } 209 }
202 210
203 /** 211 /**
204 * A {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} co mpatible with the 212 * A {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} co mpatible with the
205 * API 21 version of the framework in which 213 * API 21 version of the framework in which
206 * {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate} had not yet been 214 * {@link android.webkit.WebViewDelegate android.webkit.WebViewDelegate} had not yet been
207 * introduced. 215 * introduced.
208 * 216 *
209 * <p>This class implements the 217 * <p>This class implements the
210 * {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} func tionality by using 218 * {@link WebViewDelegate com.android.webview.chromium.WebViewDelegate} func tionality by using
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 try { 384 try {
377 PackageInfo info = (PackageInfo) mGetLoadedPackageInfoMethod.inv oke(null); 385 PackageInfo info = (PackageInfo) mGetLoadedPackageInfoMethod.inv oke(null);
378 // Avoid calling the ContextWrapper.getAssets() proxy 386 // Avoid calling the ContextWrapper.getAssets() proxy
379 // chain, which can return an unexpected AssetManager. 387 // chain, which can return an unexpected AssetManager.
380 mAddAssetPathMethod.invoke( 388 mAddAssetPathMethod.invoke(
381 context.getResources().getAssets(), info.applicationInfo .sourceDir); 389 context.getResources().getAssets(), info.applicationInfo .sourceDir);
382 } catch (Exception e) { 390 } catch (Exception e) {
383 throw new RuntimeException("Invalid reflection", e); 391 throw new RuntimeException("Invalid reflection", e);
384 } 392 }
385 } 393 }
394
395 @Override
396 public boolean isMultiProcessEnabled() {
397 throw new UnsupportedOperationException();
398 }
386 } 399 }
387 } 400 }
OLDNEW
« no previous file with comments | « android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698