Chromium Code Reviews| Index: blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java |
| diff --git a/blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java b/blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..df7e5eebad4ce1dbaef0feeff525ce302fd884c6 |
| --- /dev/null |
| +++ b/blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2015 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.blimp; |
| + |
| +import android.app.Activity; |
| +import android.os.Bundle; |
| + |
| +import org.chromium.base.Log; |
| +import org.chromium.base.library_loader.ProcessInitException; |
| + |
| +/** |
| + * The {@link Activity} for rendering the main Blimp client. This loads the Blimp rendering stack |
| + * and displays it. |
| + */ |
| +public class BlimpRendererActivity extends Activity implements BlimpLibraryLoader.Callback { |
| + private static final String TAG = "cr.Blimp"; |
| + private BlimpView mBlimpView; |
| + |
| + @Override |
| + protected void onCreate(Bundle savedInstanceState) { |
| + super.onCreate(savedInstanceState); |
| + try { |
| + // LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized(this); |
|
nyquist
2015/08/19 07:48:07
Nit: I guess this is supposed to be removed?
David Trainor- moved to gerrit
2015/08/21 00:49:46
Done.
|
| + BlimpLibraryLoader.startAsync(this, this); |
| + } catch (ProcessInitException e) { |
| + Log.e(TAG, "Native startup exception"); |
|
nyquist
2015/08/19 07:48:07
Nit: Would we want to include the exception here?
David Trainor- moved to gerrit
2015/08/21 00:49:46
I don't know what you mean :(. But I'm happy to c
nyquist
2015/08/21 00:52:23
Oh, I was just thinking whether we should log the
David Trainor- moved to gerrit
2015/08/21 19:02:24
Done.
|
| + System.exit(-1); |
| + return; |
| + } |
| + } |
| + |
| + @Override |
| + protected void onDestroy() { |
| + if (mBlimpView != null) { |
| + mBlimpView.destroyRenderer(); |
| + mBlimpView = null; |
| + } |
| + |
| + super.onDestroy(); |
| + } |
| + |
| + // BlimpLibraryLoader.Callback Implementation -------------------------------------------------- |
| + @Override |
| + public void onStartupComplete(boolean success) { |
| + if (!success) { |
| + Log.e(TAG, "Native startup failed"); |
| + finish(); |
| + return; |
| + } |
| + |
| + setContentView(R.layout.blimp_main); |
| + mBlimpView = (BlimpView) findViewById(R.id.renderer); |
| + mBlimpView.initializeRenderer(); |
| + } |
| +} |