Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.app; | 5 package org.chromium.content.app; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.app.Notification; | 8 import android.app.Notification; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.os.Build; | 10 import android.os.Build; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 super.onCreate(); | 33 super.onCreate(); |
| 34 // TODO(qinmin): Use the first pending download as notification, or | 34 // TODO(qinmin): Use the first pending download as notification, or |
| 35 // get a more proper notification for this. | 35 // get a more proper notification for this. |
| 36 startForeground(R.id.download_service_notification, new Notification()); | 36 startForeground(R.id.download_service_notification, new Notification()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 @Override | 39 @Override |
| 40 @SuppressLint("NewApi") | 40 @SuppressLint("NewApi") |
| 41 public int onStartCommand(Intent intent, int flags, int startId) { | 41 public int onStartCommand(Intent intent, int flags, int startId) { |
| 42 assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2; | 42 assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2; |
| 43 initializeParams(intent); | 43 ChildProcessServiceImpl impl = getChildProcessServiceImpl(); |
|
Maria
2016/06/17 17:09:24
I think that instead of surfacing the impl and let
Xi Han
2016/06/17 18:35:20
That is what I did before. Sorry Peter, revert it
| |
| 44 impl.initializeParams(intent); | |
| 44 Bundle bundle = intent.getExtras(); | 45 Bundle bundle = intent.getExtras(); |
| 45 if (bundle != null) { | 46 if (bundle != null) { |
| 46 IBinder binder = bundle.getBinder(ChildProcessConstants.EXTRA_CHILD_ PROCESS_CALLBACK); | 47 IBinder binder = bundle.getBinder(ChildProcessConstants.EXTRA_CHILD_ PROCESS_CALLBACK); |
| 47 mCallback = IChildProcessCallback.Stub.asInterface(binder); | 48 mCallback = IChildProcessCallback.Stub.asInterface(binder); |
| 48 getServiceInfo(bundle); | 49 impl.getServiceInfo(bundle); |
| 49 } | 50 } |
| 50 return START_STICKY; | 51 return START_STICKY; |
| 51 } | 52 } |
| 52 | 53 |
| 53 /** | 54 /** |
| 54 * Will be called by the native side when a download starts or is rejected. | 55 * Will be called by the native side when a download starts or is rejected. |
| 55 * | 56 * |
| 56 * @CalledByNative | 57 * @CalledByNative |
| 57 */ | 58 */ |
| 58 private void onDownloadStarted(boolean started, int downloadId) { | 59 private void onDownloadStarted(boolean started, int downloadId) { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 69 /** | 70 /** |
| 70 * Will be called by the native side when a download completes. | 71 * Will be called by the native side when a download completes. |
| 71 * | 72 * |
| 72 * @CalledByNative | 73 * @CalledByNative |
| 73 */ | 74 */ |
| 74 private void onDownloadCompleted(boolean success) { | 75 private void onDownloadCompleted(boolean success) { |
| 75 mDownloadCount--; | 76 mDownloadCount--; |
| 76 if (mDownloadCount == 0) stopSelf(); | 77 if (mDownloadCount == 0) stopSelf(); |
| 77 } | 78 } |
| 78 } | 79 } |
| OLD | NEW |