| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.content.browser; | |
| 6 | |
| 7 import android.content.Context; | |
| 8 import android.os.Bundle; | |
| 9 | |
| 10 import org.chromium.base.process_launcher.ChildProcessCreationParams; | |
| 11 | |
| 12 /** | |
| 13 * A connection that is bound as important, meaning the framework brings it to t
he foreground | |
| 14 * process level when the app is. | |
| 15 */ | |
| 16 public class ImportantChildProcessConnection extends BaseChildProcessConnection
{ | |
| 17 public static final Factory FACTORY = new BaseChildProcessConnection.Factory
() { | |
| 18 @Override | |
| 19 public BaseChildProcessConnection create(Context context, int number, bo
olean sandboxed, | |
| 20 DeathCallback deathCallback, String serviceClassName, | |
| 21 Bundle childProcessCommonParameters, ChildProcessCreationParams
creationParams) { | |
| 22 return new ImportantChildProcessConnection(context, number, sandboxe
d, deathCallback, | |
| 23 serviceClassName, childProcessCommonParameters, creationPara
ms); | |
| 24 } | |
| 25 }; | |
| 26 | |
| 27 private final ChildServiceConnection mBinding; | |
| 28 | |
| 29 private ImportantChildProcessConnection(Context context, int number, boolean
sandboxed, | |
| 30 DeathCallback deathCallback, String serviceClassName, | |
| 31 Bundle childProcessCommonParameters, ChildProcessCreationParams crea
tionParams) { | |
| 32 super(context, number, sandboxed, deathCallback, serviceClassName, | |
| 33 childProcessCommonParameters, creationParams); | |
| 34 int flags = Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT; | |
| 35 if (shouldBindAsExportedService()) { | |
| 36 flags |= Context.BIND_EXTERNAL_SERVICE; | |
| 37 } | |
| 38 mBinding = createServiceConnection(flags); | |
| 39 } | |
| 40 | |
| 41 @Override | |
| 42 public boolean bind() { | |
| 43 return mBinding.bind(); | |
| 44 } | |
| 45 | |
| 46 @Override | |
| 47 public void unbind() { | |
| 48 mBinding.unbind(); | |
| 49 } | |
| 50 } | |
| OLD | NEW |