Chromium Code Reviews| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 public WebViewChromiumFactoryProvider(android.webkit.WebViewDelegate delegat e) { | 185 public WebViewChromiumFactoryProvider(android.webkit.WebViewDelegate delegat e) { |
| 186 initialize(WebViewDelegateFactory.createProxyDelegate(delegate)); | 186 initialize(WebViewDelegateFactory.createProxyDelegate(delegate)); |
| 187 } | 187 } |
| 188 | 188 |
| 189 @SuppressFBWarnings("DMI_HARDCODED_ABSOLUTE_FILENAME") | 189 @SuppressFBWarnings("DMI_HARDCODED_ABSOLUTE_FILENAME") |
| 190 private void initialize(WebViewDelegate webViewDelegate) { | 190 private void initialize(WebViewDelegate webViewDelegate) { |
| 191 mWebViewDelegate = webViewDelegate; | 191 mWebViewDelegate = webViewDelegate; |
| 192 | 192 |
| 193 // WebView needs to make sure to always use the wrapped application cont ext. | 193 // WebView needs to make sure to always use the wrapped application cont ext. |
| 194 ContextUtils.initApplicationContext( | 194 ContextUtils.initApplicationContext( |
| 195 ResourcesContextWrapperFactory.get( | 195 ResourcesContextWrapperFactory.get(mWebViewDelegate.getApplicati on())); |
|
boliu
2016/08/15 21:16:38
while I don't necessarily think this is wrong, why
Peter Wen
2016/08/15 21:49:54
We want the application object to be cached if .ge
boliu
2016/08/15 22:21:32
That's not true.. If app intentionally wraps getAp
| |
| 196 mWebViewDelegate.getApplication().getApplicationContext( ))); | |
| 197 | 196 |
| 198 if (isBuildDebuggable()) { | 197 if (isBuildDebuggable()) { |
| 199 // Suppress the StrictMode violation as this codepath is only hit on debuggable builds. | 198 // Suppress the StrictMode violation as this codepath is only hit on debuggable builds. |
| 200 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads( ); | 199 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads( ); |
| 201 CommandLine.initFromFile(COMMAND_LINE_FILE); | 200 CommandLine.initFromFile(COMMAND_LINE_FILE); |
| 202 StrictMode.setThreadPolicy(oldPolicy); | 201 StrictMode.setThreadPolicy(oldPolicy); |
| 203 } else { | 202 } else { |
| 204 CommandLine.init(null); | 203 CommandLine.init(null); |
| 205 } | 204 } |
| 206 | 205 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 mWebViewDatabase = new WebViewDatabaseAdapter(this, awDatabase); | 560 mWebViewDatabase = new WebViewDatabaseAdapter(this, awDatabase); |
| 562 } | 561 } |
| 563 } | 562 } |
| 564 return mWebViewDatabase; | 563 return mWebViewDatabase; |
| 565 } | 564 } |
| 566 | 565 |
| 567 WebViewDelegate getWebViewDelegate() { | 566 WebViewDelegate getWebViewDelegate() { |
| 568 return mWebViewDelegate; | 567 return mWebViewDelegate; |
| 569 } | 568 } |
| 570 } | 569 } |
| OLD | NEW |