| 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; |
| 11 import android.content.Intent; | 11 import android.content.Intent; |
| 12 import android.content.SharedPreferences; | 12 import android.content.SharedPreferences; |
| 13 import android.content.pm.PackageInfo; | 13 import android.content.pm.PackageInfo; |
| 14 import android.content.pm.PackageManager; | 14 import android.content.pm.PackageManager; |
| 15 import android.net.Uri; | 15 import android.net.Uri; |
| 16 import android.os.Build; | 16 import android.os.Build; |
| 17 import android.os.Looper; | 17 import android.os.Looper; |
| 18 import android.os.Process; | 18 import android.os.Process; |
| 19 import android.os.StrictMode; | 19 import android.os.StrictMode; |
| 20 import android.os.UserManager; | 20 import android.os.UserManager; |
| 21 import android.provider.Settings; | 21 import android.provider.Settings; |
| 22 import android.util.Log; | 22 import android.util.Log; |
| 23 import android.webkit.CookieManager; | 23 import android.webkit.CookieManager; |
| 24 import android.webkit.GeolocationPermissions; | 24 import android.webkit.GeolocationPermissions; |
| 25 import android.webkit.ServiceWorkerController; | 25 import android.webkit.ServiceWorkerController; |
| 26 import android.webkit.TokenBindingService; | 26 import android.webkit.TokenBindingService; |
| 27 import android.webkit.ValueCallback; |
| 27 import android.webkit.WebStorage; | 28 import android.webkit.WebStorage; |
| 28 import android.webkit.WebView; | 29 import android.webkit.WebView; |
| 29 import android.webkit.WebViewDatabase; | 30 import android.webkit.WebViewDatabase; |
| 30 import android.webkit.WebViewFactory; | 31 import android.webkit.WebViewFactory; |
| 31 import android.webkit.WebViewFactoryProvider; | 32 import android.webkit.WebViewFactoryProvider; |
| 32 import android.webkit.WebViewProvider; | 33 import android.webkit.WebViewProvider; |
| 33 | 34 |
| 34 import com.android.webview.chromium.WebViewDelegateFactory.WebViewDelegate; | 35 import com.android.webview.chromium.WebViewDelegateFactory.WebViewDelegate; |
| 35 | 36 |
| 36 import org.chromium.android_webview.AwBrowserContext; | 37 import org.chromium.android_webview.AwBrowserContext; |
| 37 import org.chromium.android_webview.AwBrowserProcess; | 38 import org.chromium.android_webview.AwBrowserProcess; |
| 38 import org.chromium.android_webview.AwContents; | 39 import org.chromium.android_webview.AwContents; |
| 39 import org.chromium.android_webview.AwContentsClient; | 40 import org.chromium.android_webview.AwContentsClient; |
| 40 import org.chromium.android_webview.AwContentsStatics; | 41 import org.chromium.android_webview.AwContentsStatics; |
| 41 import org.chromium.android_webview.AwCookieManager; | 42 import org.chromium.android_webview.AwCookieManager; |
| 42 import org.chromium.android_webview.AwDevToolsServer; | 43 import org.chromium.android_webview.AwDevToolsServer; |
| 44 import org.chromium.android_webview.AwMetricsServiceClient; |
| 43 import org.chromium.android_webview.AwNetworkChangeNotifierRegistrationPolicy; | 45 import org.chromium.android_webview.AwNetworkChangeNotifierRegistrationPolicy; |
| 44 import org.chromium.android_webview.AwQuotaManagerBridge; | 46 import org.chromium.android_webview.AwQuotaManagerBridge; |
| 45 import org.chromium.android_webview.AwResource; | 47 import org.chromium.android_webview.AwResource; |
| 46 import org.chromium.android_webview.AwSettings; | 48 import org.chromium.android_webview.AwSettings; |
| 47 import org.chromium.android_webview.HttpAuthDatabase; | 49 import org.chromium.android_webview.HttpAuthDatabase; |
| 50 import org.chromium.android_webview.PlatformServiceBridge; |
| 48 import org.chromium.android_webview.ResourcesContextWrapperFactory; | 51 import org.chromium.android_webview.ResourcesContextWrapperFactory; |
| 49 import org.chromium.base.BuildConfig; | 52 import org.chromium.base.BuildConfig; |
| 50 import org.chromium.base.CommandLine; | 53 import org.chromium.base.CommandLine; |
| 51 import org.chromium.base.ContextUtils; | 54 import org.chromium.base.ContextUtils; |
| 52 import org.chromium.base.MemoryPressureListener; | 55 import org.chromium.base.MemoryPressureListener; |
| 53 import org.chromium.base.PackageUtils; | 56 import org.chromium.base.PackageUtils; |
| 54 import org.chromium.base.PathService; | 57 import org.chromium.base.PathService; |
| 55 import org.chromium.base.PathUtils; | 58 import org.chromium.base.PathUtils; |
| 56 import org.chromium.base.ThreadUtils; | 59 import org.chromium.base.ThreadUtils; |
| 57 import org.chromium.base.TraceEvent; | 60 import org.chromium.base.TraceEvent; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 LibraryLoader.get(LibraryProcessType.PROCESS_WEBVIEW).ensureInitiali
zed(); | 392 LibraryLoader.get(LibraryProcessType.PROCESS_WEBVIEW).ensureInitiali
zed(); |
| 390 } catch (ProcessInitException e) { | 393 } catch (ProcessInitException e) { |
| 391 throw new RuntimeException("Error initializing WebView library", e); | 394 throw new RuntimeException("Error initializing WebView library", e); |
| 392 } | 395 } |
| 393 | 396 |
| 394 PathService.override(PathService.DIR_MODULE, "/system/lib/"); | 397 PathService.override(PathService.DIR_MODULE, "/system/lib/"); |
| 395 PathService.override(DIR_RESOURCE_PAKS_ANDROID, "/system/framework/webvi
ew/paks"); | 398 PathService.override(DIR_RESOURCE_PAKS_ANDROID, "/system/framework/webvi
ew/paks"); |
| 396 | 399 |
| 397 // Make sure that ResourceProvider is initialized before starting the br
owser process. | 400 // Make sure that ResourceProvider is initialized before starting the br
owser process. |
| 398 final String webViewPackageName = WebViewFactory.getLoadedPackageInfo().
packageName; | 401 final String webViewPackageName = WebViewFactory.getLoadedPackageInfo().
packageName; |
| 399 Context context = ContextUtils.getApplicationContext(); | 402 final Context context = ContextUtils.getApplicationContext(); |
| 400 setUpResources(webViewPackageName, context); | 403 setUpResources(webViewPackageName, context); |
| 401 initPlatSupportLibrary(); | 404 initPlatSupportLibrary(); |
| 402 initNetworkChangeNotifier(context); | 405 initNetworkChangeNotifier(context); |
| 403 final boolean isExternalService = true; | 406 final boolean isExternalService = true; |
| 404 AwBrowserProcess.configureChildProcessLauncher(webViewPackageName, isExt
ernalService); | 407 AwBrowserProcess.configureChildProcessLauncher(webViewPackageName, isExt
ernalService); |
| 405 AwBrowserProcess.start(); | 408 AwBrowserProcess.start(); |
| 406 AwBrowserProcess.handleMinidumps(webViewPackageName); | 409 AwBrowserProcess.handleMinidumps(webViewPackageName); |
| 407 | 410 |
| 411 PlatformServiceBridge.getInstance(context) |
| 412 .queryMetricsSetting(new ValueCallback<Boolean>() { |
| 413 public void onReceiveValue(Boolean enabled) { |
| 414 ThreadUtils.assertOnUiThread(); |
| 415 AwMetricsServiceClient.setConsentSetting(context, enable
d); |
| 416 } |
| 417 }); |
| 418 |
| 408 if (isBuildDebuggable()) { | 419 if (isBuildDebuggable()) { |
| 409 setWebContentsDebuggingEnabled(true); | 420 setWebContentsDebuggingEnabled(true); |
| 410 } | 421 } |
| 411 | 422 |
| 412 TraceEvent.setATraceEnabled(mWebViewDelegate.isTraceTagEnabled()); | 423 TraceEvent.setATraceEnabled(mWebViewDelegate.isTraceTagEnabled()); |
| 413 mWebViewDelegate.setOnTraceEnabledChangeListener( | 424 mWebViewDelegate.setOnTraceEnabledChangeListener( |
| 414 new WebViewDelegate.OnTraceEnabledChangeListener() { | 425 new WebViewDelegate.OnTraceEnabledChangeListener() { |
| 415 @Override | 426 @Override |
| 416 public void onTraceEnabledChange(boolean enabled) { | 427 public void onTraceEnabledChange(boolean enabled) { |
| 417 TraceEvent.setATraceEnabled(enabled); | 428 TraceEvent.setATraceEnabled(enabled); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 this, HttpAuthDatabase.newInstance(context, HTTP_AUTH_DA
TABASE_FILE)); | 663 this, HttpAuthDatabase.newInstance(context, HTTP_AUTH_DA
TABASE_FILE)); |
| 653 } | 664 } |
| 654 } | 665 } |
| 655 return mWebViewDatabase; | 666 return mWebViewDatabase; |
| 656 } | 667 } |
| 657 | 668 |
| 658 WebViewDelegate getWebViewDelegate() { | 669 WebViewDelegate getWebViewDelegate() { |
| 659 return mWebViewDelegate; | 670 return mWebViewDelegate; |
| 660 } | 671 } |
| 661 } | 672 } |
| OLD | NEW |