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.content.browser; |
6 | 6 |
7 import android.content.ComponentName; | 7 import android.content.ComponentName; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.ServiceConnection; | 10 import android.content.ServiceConnection; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 169 } |
170 try { | 170 try { |
171 TraceEvent.begin( | 171 TraceEvent.begin( |
172 "ChildProcessConnectionImpl.ChildServiceConnection.o
nServiceConnected"); | 172 "ChildProcessConnectionImpl.ChildServiceConnection.o
nServiceConnected"); |
173 mDidOnServiceConnected = true; | 173 mDidOnServiceConnected = true; |
174 mService = IChildProcessService.Stub.asInterface(service); | 174 mService = IChildProcessService.Stub.asInterface(service); |
175 | 175 |
176 StartCallback startCallback = mStartCallback; | 176 StartCallback startCallback = mStartCallback; |
177 mStartCallback = null; | 177 mStartCallback = null; |
178 | 178 |
| 179 final boolean bindCheck = |
| 180 mCreationParams != null && mCreationParams.getBindTo
CallerCheck(); |
179 boolean boundToUs = false; | 181 boolean boundToUs = false; |
180 try { | 182 try { |
181 boundToUs = mService.bindToCaller(); | 183 boundToUs = bindCheck ? mService.bindToCaller() : true; |
182 } catch (RemoteException ex) { | 184 } catch (RemoteException ex) { |
183 // Do not trigger the StartCallback here, since the serv
ice is already | 185 // Do not trigger the StartCallback here, since the serv
ice is already |
184 // dead and the DeathCallback will run from onServiceDis
connected(). | 186 // dead and the DeathCallback will run from onServiceDis
connected(). |
185 Log.e(TAG, "Failed to bind service to connection.", ex); | 187 Log.e(TAG, "Failed to bind service to connection.", ex); |
186 return; | 188 return; |
187 } | 189 } |
188 | 190 |
189 if (startCallback != null) { | 191 if (startCallback != null) { |
190 if (boundToUs) { | 192 if (boundToUs) { |
191 startCallback.onChildStarted(); | 193 startCallback.onChildStarted(); |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 return true; | 554 return true; |
553 } | 555 } |
554 return false; | 556 return false; |
555 } | 557 } |
556 | 558 |
557 @VisibleForTesting | 559 @VisibleForTesting |
558 public boolean isConnected() { | 560 public boolean isConnected() { |
559 return mService != null; | 561 return mService != null; |
560 } | 562 } |
561 } | 563 } |
OLD | NEW |