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.app.ActivityManager; | 7 import android.app.ActivityManager; |
8 import android.content.ComponentCallbacks2; | 8 import android.content.ComponentCallbacks2; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.Intent; | 10 import android.content.Intent; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // Initialization guarded by mLock. | 73 // Initialization guarded by mLock. |
74 private AwBrowserContext mBrowserContext; | 74 private AwBrowserContext mBrowserContext; |
75 private Statics mStaticMethods; | 75 private Statics mStaticMethods; |
76 private GeolocationPermissionsAdapter mGeolocationPermissions; | 76 private GeolocationPermissionsAdapter mGeolocationPermissions; |
77 private CookieManagerAdapter mCookieManager; | 77 private CookieManagerAdapter mCookieManager; |
78 private WebIconDatabaseAdapter mWebIconDatabase; | 78 private WebIconDatabaseAdapter mWebIconDatabase; |
79 private WebStorageAdapter mWebStorage; | 79 private WebStorageAdapter mWebStorage; |
80 private WebViewDatabaseAdapter mWebViewDatabase; | 80 private WebViewDatabaseAdapter mWebViewDatabase; |
81 private AwDevToolsServer mDevToolsServer; | 81 private AwDevToolsServer mDevToolsServer; |
| 82 private Context mWrappedAppContext; |
82 | 83 |
83 private ArrayList<WeakReference<WebViewChromium>> mWebViewsToStart = | 84 private ArrayList<WeakReference<WebViewChromium>> mWebViewsToStart = |
84 new ArrayList<WeakReference<WebViewChromium>>(); | 85 new ArrayList<WeakReference<WebViewChromium>>(); |
85 | 86 |
86 // Read/write protected by mLock. | 87 // Read/write protected by mLock. |
87 private boolean mStarted; | 88 private boolean mStarted; |
88 private AwDataReductionProxyManager mProxyManager; | 89 private AwDataReductionProxyManager mProxyManager; |
89 | 90 |
90 private SharedPreferences mWebViewPrefs; | 91 private SharedPreferences mWebViewPrefs; |
91 private WebViewDelegate mWebViewDelegate; | 92 private WebViewDelegate mWebViewDelegate; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 return mStarted; | 285 return mStarted; |
285 } | 286 } |
286 | 287 |
287 void startYourEngines(boolean onMainThread) { | 288 void startYourEngines(boolean onMainThread) { |
288 synchronized (mLock) { | 289 synchronized (mLock) { |
289 ensureChromiumStartedLocked(onMainThread); | 290 ensureChromiumStartedLocked(onMainThread); |
290 } | 291 } |
291 } | 292 } |
292 | 293 |
293 private Context getWrappedCurrentApplicationContext() { | 294 private Context getWrappedCurrentApplicationContext() { |
294 return ResourcesContextWrapperFactory.get(mWebViewDelegate.getApplicatio
n()); | 295 if (mWrappedAppContext == null) { |
| 296 mWrappedAppContext = ResourcesContextWrapperFactory.get( |
| 297 mWebViewDelegate.getApplication()); |
| 298 } |
| 299 return mWrappedAppContext; |
295 } | 300 } |
296 | 301 |
297 AwBrowserContext getBrowserContext() { | 302 AwBrowserContext getBrowserContext() { |
298 synchronized (mLock) { | 303 synchronized (mLock) { |
299 return getBrowserContextLocked(); | 304 return getBrowserContextLocked(); |
300 } | 305 } |
301 } | 306 } |
302 | 307 |
303 private AwBrowserContext getBrowserContextLocked() { | 308 private AwBrowserContext getBrowserContextLocked() { |
304 assert Thread.holdsLock(mLock); | 309 assert Thread.holdsLock(mLock); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 browserContext.getHttpAuthDatabase(context)); | 467 browserContext.getHttpAuthDatabase(context)); |
463 } | 468 } |
464 } | 469 } |
465 return mWebViewDatabase; | 470 return mWebViewDatabase; |
466 } | 471 } |
467 | 472 |
468 WebViewDelegate getWebViewDelegate() { | 473 WebViewDelegate getWebViewDelegate() { |
469 return mWebViewDelegate; | 474 return mWebViewDelegate; |
470 } | 475 } |
471 } | 476 } |
OLD | NEW |