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