| OLD | NEW |
| 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.Manifest; | 7 import android.Manifest; |
| 8 import android.app.ActivityManager; | 8 import android.app.ActivityManager; |
| 9 import android.content.ComponentCallbacks2; | 9 import android.content.ComponentCallbacks2; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 import android.webkit.WebViewProvider; | 28 import android.webkit.WebViewProvider; |
| 29 | 29 |
| 30 import com.android.webview.chromium.WebViewDelegateFactory.WebViewDelegate; | 30 import com.android.webview.chromium.WebViewDelegateFactory.WebViewDelegate; |
| 31 | 31 |
| 32 import org.chromium.android_webview.AwBrowserContext; | 32 import org.chromium.android_webview.AwBrowserContext; |
| 33 import org.chromium.android_webview.AwBrowserProcess; | 33 import org.chromium.android_webview.AwBrowserProcess; |
| 34 import org.chromium.android_webview.AwContents; | 34 import org.chromium.android_webview.AwContents; |
| 35 import org.chromium.android_webview.AwContentsClient; | 35 import org.chromium.android_webview.AwContentsClient; |
| 36 import org.chromium.android_webview.AwContentsStatics; | 36 import org.chromium.android_webview.AwContentsStatics; |
| 37 import org.chromium.android_webview.AwCookieManager; | 37 import org.chromium.android_webview.AwCookieManager; |
| 38 import org.chromium.android_webview.AwDataReductionProxyManager; | |
| 39 import org.chromium.android_webview.AwDevToolsServer; | 38 import org.chromium.android_webview.AwDevToolsServer; |
| 40 import org.chromium.android_webview.AwNetworkChangeNotifierRegistrationPolicy; | 39 import org.chromium.android_webview.AwNetworkChangeNotifierRegistrationPolicy; |
| 41 import org.chromium.android_webview.AwQuotaManagerBridge; | 40 import org.chromium.android_webview.AwQuotaManagerBridge; |
| 42 import org.chromium.android_webview.AwResource; | 41 import org.chromium.android_webview.AwResource; |
| 43 import org.chromium.android_webview.AwSettings; | 42 import org.chromium.android_webview.AwSettings; |
| 44 import org.chromium.android_webview.R; | 43 import org.chromium.android_webview.R; |
| 45 import org.chromium.android_webview.ResourcesContextWrapperFactory; | 44 import org.chromium.android_webview.ResourcesContextWrapperFactory; |
| 46 import org.chromium.base.CommandLine; | 45 import org.chromium.base.CommandLine; |
| 47 import org.chromium.base.ContextUtils; | 46 import org.chromium.base.ContextUtils; |
| 48 import org.chromium.base.MemoryPressureListener; | 47 import org.chromium.base.MemoryPressureListener; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 private WebIconDatabaseAdapter mWebIconDatabase; | 85 private WebIconDatabaseAdapter mWebIconDatabase; |
| 87 private WebStorageAdapter mWebStorage; | 86 private WebStorageAdapter mWebStorage; |
| 88 private WebViewDatabaseAdapter mWebViewDatabase; | 87 private WebViewDatabaseAdapter mWebViewDatabase; |
| 89 private AwDevToolsServer mDevToolsServer; | 88 private AwDevToolsServer mDevToolsServer; |
| 90 | 89 |
| 91 private ArrayList<WeakReference<WebViewChromium>> mWebViewsToStart = | 90 private ArrayList<WeakReference<WebViewChromium>> mWebViewsToStart = |
| 92 new ArrayList<WeakReference<WebViewChromium>>(); | 91 new ArrayList<WeakReference<WebViewChromium>>(); |
| 93 | 92 |
| 94 // Read/write protected by mLock. | 93 // Read/write protected by mLock. |
| 95 private boolean mStarted; | 94 private boolean mStarted; |
| 96 private AwDataReductionProxyManager mProxyManager; | |
| 97 | 95 |
| 98 private SharedPreferences mWebViewPrefs; | 96 private SharedPreferences mWebViewPrefs; |
| 99 private WebViewDelegate mWebViewDelegate; | 97 private WebViewDelegate mWebViewDelegate; |
| 100 | 98 |
| 101 /** | 99 /** |
| 102 * Constructor called by the API 21 version of {@link WebViewFactory} and ea
rlier. | 100 * Constructor called by the API 21 version of {@link WebViewFactory} and ea
rlier. |
| 103 */ | 101 */ |
| 104 public WebViewChromiumFactoryProvider() { | 102 public WebViewChromiumFactoryProvider() { |
| 105 initialize(WebViewDelegateFactory.createApi21CompatibilityDelegate()); | 103 initialize(WebViewDelegateFactory.createApi21CompatibilityDelegate()); |
| 106 } | 104 } |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 mStarted = true; | 302 mStarted = true; |
| 305 | 303 |
| 306 for (WeakReference<WebViewChromium> wvc : mWebViewsToStart) { | 304 for (WeakReference<WebViewChromium> wvc : mWebViewsToStart) { |
| 307 WebViewChromium w = wvc.get(); | 305 WebViewChromium w = wvc.get(); |
| 308 if (w != null) { | 306 if (w != null) { |
| 309 w.startYourEngine(); | 307 w.startYourEngine(); |
| 310 } | 308 } |
| 311 } | 309 } |
| 312 mWebViewsToStart.clear(); | 310 mWebViewsToStart.clear(); |
| 313 mWebViewsToStart = null; | 311 mWebViewsToStart = null; |
| 314 | |
| 315 // Start listening for data reduction proxy setting changes. | |
| 316 mProxyManager = new AwDataReductionProxyManager(); | |
| 317 mProxyManager.start(ContextUtils.getApplicationContext()); | |
| 318 } | 312 } |
| 319 | 313 |
| 320 boolean hasStarted() { | 314 boolean hasStarted() { |
| 321 return mStarted; | 315 return mStarted; |
| 322 } | 316 } |
| 323 | 317 |
| 324 void startYourEngines(boolean onMainThread) { | 318 void startYourEngines(boolean onMainThread) { |
| 325 synchronized (mLock) { | 319 synchronized (mLock) { |
| 326 ensureChromiumStartedLocked(onMainThread); | 320 ensureChromiumStartedLocked(onMainThread); |
| 327 } | 321 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 browserContext.getHttpAuthDatabase(context)); | 480 browserContext.getHttpAuthDatabase(context)); |
| 487 } | 481 } |
| 488 } | 482 } |
| 489 return mWebViewDatabase; | 483 return mWebViewDatabase; |
| 490 } | 484 } |
| 491 | 485 |
| 492 WebViewDelegate getWebViewDelegate() { | 486 WebViewDelegate getWebViewDelegate() { |
| 493 return mWebViewDelegate; | 487 return mWebViewDelegate; |
| 494 } | 488 } |
| 495 } | 489 } |
| OLD | NEW |