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

Side by Side Diff: mojo/shell/android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.mojo.shell;
6
7 import android.util.Log;
8
9 import org.chromium.base.BaseChromiumApplication;
10 import org.chromium.base.PathUtils;
11 import org.chromium.base.library_loader.LibraryLoader;
12 import org.chromium.base.library_loader.LibraryProcessType;
13 import org.chromium.base.library_loader.ProcessInitException;
14
15 /**
16 * MojoShell implementation of {@link android.app.Application}, managing applica tion-level global
17 * state and initializations.
18 */
19 public class MojoShellApplication extends BaseChromiumApplication {
20 private static final String TAG = "MojoShellApplication";
21 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "mojo_shell";
22
23 @Override
24 public void onCreate() {
25 super.onCreate();
26 clearTemporaryFiles();
27 initializeJavaUtils();
28 initializeNative();
29 }
30
31 /**
32 * Deletes the temporary files and directories created in the previous run o f the application.
33 * This is important regardless of cleanups on exit, as the previous run cou ld have crashed.
34 */
35 private void clearTemporaryFiles() {
36 AndroidHandler.clearTemporaryFiles(this);
37 }
38
39 /**
40 * Initializes Java-side utils.
41 */
42 private void initializeJavaUtils() {
43 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);
44 }
45
46 /**
47 * Loads the native library.
48 */
49 private void initializeNative() {
50 try {
51 LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitiali zed();
52 } catch (ProcessInitException e) {
53 Log.e(TAG, "libmojo_shell initialization failed.", e);
54 throw new RuntimeException(e);
55 }
56 }
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698