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 doNetworkInitializations(Context applicationContext) { | 347 private void initNetworkChangeNotifier(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); | |
359 } | 354 } |
360 | 355 |
361 private void ensureChromiumStartedLocked(boolean onMainThread) { | 356 private void ensureChromiumStartedLocked(boolean onMainThread) { |
362 assert Thread.holdsLock(mLock); | 357 assert Thread.holdsLock(mLock); |
363 | 358 |
364 if (mStarted) { // Early-out for the common case. | 359 if (mStarted) { // Early-out for the common case. |
365 return; | 360 return; |
366 } | 361 } |
367 | 362 |
368 Looper looper = !onMainThread ? Looper.myLooper() : Looper.getMainLooper
(); | 363 Looper looper = !onMainThread ? Looper.myLooper() : Looper.getMainLooper
(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 } | 415 } |
421 | 416 |
422 PathService.override(PathService.DIR_MODULE, "/system/lib/"); | 417 PathService.override(PathService.DIR_MODULE, "/system/lib/"); |
423 PathService.override(DIR_RESOURCE_PAKS_ANDROID, "/system/framework/webvi
ew/paks"); | 418 PathService.override(DIR_RESOURCE_PAKS_ANDROID, "/system/framework/webvi
ew/paks"); |
424 | 419 |
425 // Make sure that ResourceProvider is initialized before starting the br
owser process. | 420 // Make sure that ResourceProvider is initialized before starting the br
owser process. |
426 final String webViewPackageName = WebViewFactory.getLoadedPackageInfo().
packageName; | 421 final String webViewPackageName = WebViewFactory.getLoadedPackageInfo().
packageName; |
427 final Context context = ContextUtils.getApplicationContext(); | 422 final Context context = ContextUtils.getApplicationContext(); |
428 setUpResources(webViewPackageName, context); | 423 setUpResources(webViewPackageName, context); |
429 initPlatSupportLibrary(); | 424 initPlatSupportLibrary(); |
430 doNetworkInitializations(context); | 425 initNetworkChangeNotifier(context); |
431 final boolean isExternalService = true; | 426 final boolean isExternalService = true; |
432 AwBrowserProcess.configureChildProcessLauncher(webViewPackageName, isExt
ernalService); | 427 AwBrowserProcess.configureChildProcessLauncher(webViewPackageName, isExt
ernalService); |
433 AwBrowserProcess.start(); | 428 AwBrowserProcess.start(); |
434 | 429 |
435 final boolean enableMinidumpUploadingForTesting = CommandLine.getInstanc
e().hasSwitch( | 430 final boolean enableMinidumpUploadingForTesting = CommandLine.getInstanc
e().hasSwitch( |
436 CRASH_UPLOADS_ENABLED_FOR_TESTING_SWITCH); | 431 CRASH_UPLOADS_ENABLED_FOR_TESTING_SWITCH); |
437 if (enableMinidumpUploadingForTesting) { | 432 if (enableMinidumpUploadingForTesting) { |
438 AwBrowserProcess.handleMinidumps(webViewPackageName, true /* enabled
*/); | 433 AwBrowserProcess.handleMinidumps(webViewPackageName, true /* enabled
*/); |
439 } | 434 } |
440 | 435 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 WebViewDelegate getWebViewDelegate() { | 700 WebViewDelegate getWebViewDelegate() { |
706 return mWebViewDelegate; | 701 return mWebViewDelegate; |
707 } | 702 } |
708 | 703 |
709 // The method to support unreleased Android. | 704 // The method to support unreleased Android. |
710 WebViewContentsClientAdapter createWebViewContentsClientAdapter(WebView webV
iew, | 705 WebViewContentsClientAdapter createWebViewContentsClientAdapter(WebView webV
iew, |
711 Context context) { | 706 Context context) { |
712 return new WebViewContentsClientAdapter(webView, context, mWebViewDelega
te); | 707 return new WebViewContentsClientAdapter(webView, context, mWebViewDelega
te); |
713 } | 708 } |
714 } | 709 } |
OLD | NEW |