| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 } | 337 } |
| 338 return true; | 338 return true; |
| 339 } | 339 } |
| 340 | 340 |
| 341 private void initPlatSupportLibrary() { | 341 private void initPlatSupportLibrary() { |
| 342 DrawGLFunctor.setChromiumAwDrawGLFunction(AwContents.getAwDrawGLFunction
()); | 342 DrawGLFunctor.setChromiumAwDrawGLFunction(AwContents.getAwDrawGLFunction
()); |
| 343 AwContents.setAwDrawSWFunctionTable(GraphicsUtils.getDrawSWFunctionTable
()); | 343 AwContents.setAwDrawSWFunctionTable(GraphicsUtils.getDrawSWFunctionTable
()); |
| 344 AwContents.setAwDrawGLFunctionTable(GraphicsUtils.getDrawGLFunctionTable
()); | 344 AwContents.setAwDrawGLFunctionTable(GraphicsUtils.getDrawGLFunctionTable
()); |
| 345 } | 345 } |
| 346 | 346 |
| 347 private void initNetworkChangeNotifier(Context applicationContext) { | 347 private void doNetworkInitializatons(Context applicationContext) { |
| 348 if (applicationContext.checkPermission(Manifest.permission.ACCESS_NETWOR
K_STATE, | 348 if (applicationContext.checkPermission(Manifest.permission.ACCESS_NETWOR
K_STATE, |
| 349 Process.myPid(), Process.myUid()) == PackageManager.PERMISSION_G
RANTED) { | 349 Process.myPid(), Process.myUid()) == PackageManager.PERMISSION_G
RANTED) { |
| 350 NetworkChangeNotifier.init(applicationContext); | 350 NetworkChangeNotifier.init(applicationContext); |
| 351 NetworkChangeNotifier.setAutoDetectConnectivityState( | 351 NetworkChangeNotifier.setAutoDetectConnectivityState( |
| 352 new AwNetworkChangeNotifierRegistrationPolicy()); | 352 new AwNetworkChangeNotifierRegistrationPolicy()); |
| 353 } | 353 } |
| 354 |
| 355 int targetSdkVersion = applicationContext.getApplicationInfo().targetSdk
Version; |
| 356 // TODO(sgurun) We need to change this to > N_MR1 when we roll N_MR1 sdk
or |
| 357 // >= O when we roll O SDK to upstream. crbug/688556 |
| 358 AwContentsStatics.setCheckClearTextPermitted(targetSdkVersion > 25); |
| 354 } | 359 } |
| 355 | 360 |
| 356 private void ensureChromiumStartedLocked(boolean onMainThread) { | 361 private void ensureChromiumStartedLocked(boolean onMainThread) { |
| 357 assert Thread.holdsLock(mLock); | 362 assert Thread.holdsLock(mLock); |
| 358 | 363 |
| 359 if (mStarted) { // Early-out for the common case. | 364 if (mStarted) { // Early-out for the common case. |
| 360 return; | 365 return; |
| 361 } | 366 } |
| 362 | 367 |
| 363 Looper looper = !onMainThread ? Looper.myLooper() : Looper.getMainLooper
(); | 368 Looper looper = !onMainThread ? Looper.myLooper() : Looper.getMainLooper
(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 } | 420 } |
| 416 | 421 |
| 417 PathService.override(PathService.DIR_MODULE, "/system/lib/"); | 422 PathService.override(PathService.DIR_MODULE, "/system/lib/"); |
| 418 PathService.override(DIR_RESOURCE_PAKS_ANDROID, "/system/framework/webvi
ew/paks"); | 423 PathService.override(DIR_RESOURCE_PAKS_ANDROID, "/system/framework/webvi
ew/paks"); |
| 419 | 424 |
| 420 // Make sure that ResourceProvider is initialized before starting the br
owser process. | 425 // Make sure that ResourceProvider is initialized before starting the br
owser process. |
| 421 final String webViewPackageName = WebViewFactory.getLoadedPackageInfo().
packageName; | 426 final String webViewPackageName = WebViewFactory.getLoadedPackageInfo().
packageName; |
| 422 final Context context = ContextUtils.getApplicationContext(); | 427 final Context context = ContextUtils.getApplicationContext(); |
| 423 setUpResources(webViewPackageName, context); | 428 setUpResources(webViewPackageName, context); |
| 424 initPlatSupportLibrary(); | 429 initPlatSupportLibrary(); |
| 425 initNetworkChangeNotifier(context); | 430 doNetworkInitializatons(context); |
| 426 final boolean isExternalService = true; | 431 final boolean isExternalService = true; |
| 427 AwBrowserProcess.configureChildProcessLauncher(webViewPackageName, isExt
ernalService); | 432 AwBrowserProcess.configureChildProcessLauncher(webViewPackageName, isExt
ernalService); |
| 428 AwBrowserProcess.start(); | 433 AwBrowserProcess.start(); |
| 429 | 434 |
| 430 final boolean enableMinidumpUploadingForTesting = CommandLine.getInstanc
e().hasSwitch( | 435 final boolean enableMinidumpUploadingForTesting = CommandLine.getInstanc
e().hasSwitch( |
| 431 CRASH_UPLOADS_ENABLED_FOR_TESTING_SWITCH); | 436 CRASH_UPLOADS_ENABLED_FOR_TESTING_SWITCH); |
| 432 if (enableMinidumpUploadingForTesting) { | 437 if (enableMinidumpUploadingForTesting) { |
| 433 AwBrowserProcess.handleMinidumps(webViewPackageName, true /* enabled
*/); | 438 AwBrowserProcess.handleMinidumps(webViewPackageName, true /* enabled
*/); |
| 434 } | 439 } |
| 435 | 440 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 WebViewDelegate getWebViewDelegate() { | 705 WebViewDelegate getWebViewDelegate() { |
| 701 return mWebViewDelegate; | 706 return mWebViewDelegate; |
| 702 } | 707 } |
| 703 | 708 |
| 704 // The method to support unreleased Android. | 709 // The method to support unreleased Android. |
| 705 WebViewContentsClientAdapter createWebViewContentsClientAdapter(WebView webV
iew, | 710 WebViewContentsClientAdapter createWebViewContentsClientAdapter(WebView webV
iew, |
| 706 Context context) { | 711 Context context) { |
| 707 return new WebViewContentsClientAdapter(webView, context, mWebViewDelega
te); | 712 return new WebViewContentsClientAdapter(webView, context, mWebViewDelega
te); |
| 708 } | 713 } |
| 709 } | 714 } |
| OLD | NEW |