| 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.mojo.shell; | 5 package org.chromium.mojo.shell; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.Service; | 8 import android.app.Service; |
| 9 import android.content.ComponentName; | 9 import android.content.ComponentName; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 return mBinder; | 147 return mBinder; |
| 148 } | 148 } |
| 149 | 149 |
| 150 @Override | 150 @Override |
| 151 public void onTaskRemoved(Intent rootIntent) { | 151 public void onTaskRemoved(Intent rootIntent) { |
| 152 if (!rootIntent.getComponent().getClassName().equals(ViewportActivity.cl
ass.getName())) { | 152 if (!rootIntent.getComponent().getClassName().equals(ViewportActivity.cl
ass.getName())) { |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 String viewportId = rootIntent.getStringExtra("ViewportId"); | 155 String viewportId = rootIntent.getStringExtra("ViewportId"); |
| 156 NativeViewportSupportApplicationDelegate.viewportClosed(viewportId); | 156 NativeViewportSupportApplicationDelegate.viewportClosed(viewportId); |
| 157 |
| 158 if (ApplicationStatus.getRunningActivities().size() == 0) { |
| 159 // There are only background apps in the shell, so we close ourselve
s so we can cleanly |
| 160 // restart. We may want to investigate how to keep backround apps an
d restart UI |
| 161 // activities cleanly. |
| 162 nativeQuitShell(); |
| 163 } |
| 157 } | 164 } |
| 158 | 165 |
| 159 /** | 166 /** |
| 160 * Initializes the native system and starts the shell. | 167 * Initializes the native system and starts the shell. |
| 161 **/ | 168 **/ |
| 162 private void ensureStarted(Context applicationContext, List<String> args) { | 169 private void ensureStarted(Context applicationContext, List<String> args) { |
| 163 if (mInitialized) return; | 170 if (mInitialized) return; |
| 164 try { | 171 try { |
| 165 FileHelper.extractFromAssets(applicationContext, NETWORK_LIBRARY_APP
, | 172 FileHelper.extractFromAssets(applicationContext, NETWORK_LIBRARY_APP
, |
| 166 getLocalAppsDir(applicationContext), false); | 173 getLocalAppsDir(applicationContext), false); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 **/ | 321 **/ |
| 315 private static native void nativeStart(Context context, AssetManager assetMa
nager, | 322 private static native void nativeStart(Context context, AssetManager assetMa
nager, |
| 316 String mojoShellChildPath, String[] args, String bundledAppsDirector
y, String tmpDir, | 323 String mojoShellChildPath, String[] args, String bundledAppsDirector
y, String tmpDir, |
| 317 String homeDir); | 324 String homeDir); |
| 318 | 325 |
| 319 private static native void nativeAddApplicationURL(String url); | 326 private static native void nativeAddApplicationURL(String url); |
| 320 | 327 |
| 321 private static native void nativeStartApplicationURL(String url); | 328 private static native void nativeStartApplicationURL(String url); |
| 322 | 329 |
| 323 private static native void nativeBindShell(int shellHandle); | 330 private static native void nativeBindShell(int shellHandle); |
| 331 |
| 332 private static native void nativeQuitShell(); |
| 324 } | 333 } |
| OLD | NEW |