Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(794)

Unified Diff: shell/android/apk/src/org/chromium/mojo/shell/MojoMain.java

Issue 1045923003: Rename the various shell MojoMains to ShellMain. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « shell/BUILD.gn ('k') | shell/android/apk/src/org/chromium/mojo/shell/MojoShellActivity.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/android/apk/src/org/chromium/mojo/shell/MojoMain.java
diff --git a/shell/android/apk/src/org/chromium/mojo/shell/MojoMain.java b/shell/android/apk/src/org/chromium/mojo/shell/MojoMain.java
deleted file mode 100644
index d383b8d5a0f1fcd94f1fd394deba5ee902a1aa83..0000000000000000000000000000000000000000
--- a/shell/android/apk/src/org/chromium/mojo/shell/MojoMain.java
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.mojo.shell;
-
-import android.app.Activity;
-import android.content.Context;
-import android.util.Log;
-
-import org.chromium.base.CalledByNative;
-import org.chromium.base.JNINamespace;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * A placeholder class to call native functions.
- **/
-@JNINamespace("mojo::shell")
-public class MojoMain {
- private static final String TAG = "MojoMain";
-
- // Directory where applications bundled with the shell will be extracted.
- private static final String LOCAL_APP_DIRECTORY = "local_apps";
- // Individual applications bundled with the shell as assets.
- private static final String NETWORK_LIBRARY_APP = "network_service.mojo";
- // The mojo_shell library is also an executable run in forked processes when running
- // multi-process.
- private static final String MOJO_SHELL_EXECUTABLE = "libmojo_shell.so";
-
- /**
- * A guard flag for calling nativeInit() only once.
- **/
- private static boolean sInitialized = false;
-
- /**
- * Initializes the native system.
- **/
- static void ensureInitialized(Context applicationContext, String[] parameters) {
- if (sInitialized)
- return;
- try {
- FileHelper.extractFromAssets(applicationContext, NETWORK_LIBRARY_APP,
- getLocalAppsDir(applicationContext), false);
- File mojoShell = new File(applicationContext.getApplicationInfo().nativeLibraryDir,
- MOJO_SHELL_EXECUTABLE);
-
- List<String> parametersList = new ArrayList<String>();
- // Program name.
- if (parameters != null) {
- parametersList.addAll(Arrays.asList(parameters));
- }
-
- nativeInit(applicationContext, mojoShell.getAbsolutePath(),
- parametersList.toArray(new String[parametersList.size()]),
- getLocalAppsDir(applicationContext).getAbsolutePath(),
- getTmpDir(applicationContext).getAbsolutePath());
- sInitialized = true;
- } catch (Exception e) {
- Log.e(TAG, "MojoMain initialization failed.", e);
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Starts the specified application in the specified context.
- *
- * @return <code>true</code> if an application has been launched.
- **/
- static boolean start() {
- return nativeStart();
- }
-
- /**
- * Adds the given URL to the set of mojo applications to run on start.
- */
- static void addApplicationURL(String url) {
- nativeAddApplicationURL(url);
- }
-
- private static File getLocalAppsDir(Context context) {
- return context.getDir(LOCAL_APP_DIRECTORY, Context.MODE_PRIVATE);
- }
-
- private static File getTmpDir(Context context) {
- return new File(context.getCacheDir(), "tmp");
- }
-
- @CalledByNative
- private static void finishActivity(Activity activity) {
- activity.finish();
- }
-
- /**
- * Initializes the native system. This API should be called only once per process.
- **/
- private static native void nativeInit(Context context, String mojoShellPath,
- String[] parameters, String bundledAppsDirectory, String tmpDir);
-
- private static native boolean nativeStart();
-
- private static native void nativeAddApplicationURL(String url);
-}
« no previous file with comments | « shell/BUILD.gn ('k') | shell/android/apk/src/org/chromium/mojo/shell/MojoShellActivity.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698