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_apk; | 5 package org.chromium.mojo_shell_apk; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.app.AlertDialog; | 8 import android.app.AlertDialog; |
9 import android.content.DialogInterface; | 9 import android.content.DialogInterface; |
10 import android.content.Intent; | 10 import android.content.Intent; |
11 import android.os.Bundle; | 11 import android.os.Bundle; |
12 import android.util.Log; | 12 import android.util.Log; |
13 import android.widget.EditText; | 13 import android.widget.EditText; |
14 | 14 |
15 import org.chromium.base.library_loader.LibraryLoader; | 15 import org.chromium.base.library_loader.LibraryLoader; |
16 import org.chromium.base.library_loader.ProcessInitException; | 16 import org.chromium.base.library_loader.ProcessInitException; |
17 | 17 |
18 /** | 18 /** |
19 * Activity for managing the Mojo Shell. | 19 * Activity for managing the Mojo Shell. |
20 */ | 20 */ |
21 public class MojoShellActivity extends Activity { | 21 public class MojoShellActivity extends Activity { |
22 private static final String TAG = "MojoShellActivity"; | 22 private static final String TAG = "MojoShellActivity"; |
23 | 23 |
24 @Override | 24 @Override |
25 protected void onCreate(final Bundle savedInstanceState) { | 25 protected void onCreate(final Bundle savedInstanceState) { |
26 super.onCreate(savedInstanceState); | 26 super.onCreate(savedInstanceState); |
27 | 27 |
28 try { | 28 try { |
29 LibraryLoader.ensureInitialized(null); | 29 LibraryLoader.ensureInitialized(); |
30 } catch (ProcessInitException e) { | 30 } catch (ProcessInitException e) { |
31 Log.e(TAG, "libmojo_shell initialization failed.", e); | 31 Log.e(TAG, "libmojo_shell initialization failed.", e); |
32 finish(); | 32 finish(); |
33 return; | 33 return; |
34 } | 34 } |
35 | 35 |
36 MojoMain.init(this); | 36 MojoMain.init(this); |
37 | 37 |
38 String appUrl = getUrlFromIntent(getIntent()); | 38 String appUrl = getUrlFromIntent(getIntent()); |
39 if (appUrl == null) { | 39 if (appUrl == null) { |
(...skipping 18 matching lines...) Expand all Loading... |
58 | 58 |
59 private static String getUrlFromIntent(Intent intent) { | 59 private static String getUrlFromIntent(Intent intent) { |
60 return intent != null ? intent.getDataString() : null; | 60 return intent != null ? intent.getDataString() : null; |
61 } | 61 } |
62 | 62 |
63 private void startWithURL(String url) { | 63 private void startWithURL(String url) { |
64 MojoMain.start(this, url); | 64 MojoMain.start(this, url); |
65 Log.i(TAG, "Mojo started: " + url); | 65 Log.i(TAG, "Mojo started: " + url); |
66 } | 66 } |
67 } | 67 } |
OLD | NEW |