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

Unified Diff: content/shell/android/aura_shell_apk/src/org/chromium/aura_content_shell_apk/ContentShellActivity.java

Issue 1391893003: NOT FOR REVIEW: Aura on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
Index: content/shell/android/aura_shell_apk/src/org/chromium/aura_content_shell_apk/ContentShellActivity.java
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java b/content/shell/android/aura_shell_apk/src/org/chromium/aura_content_shell_apk/ContentShellActivity.java
similarity index 63%
copy from content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
copy to content/shell/android/aura_shell_apk/src/org/chromium/aura_content_shell_apk/ContentShellActivity.java
index 95ab6033a6c74bb4eb7c8a86ff6c91b09d28d3c9..f9d7d563e227f78d2091f286d4373bdb60778ea7 100644
--- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
+++ b/content/shell/android/aura_shell_apk/src/org/chromium/aura_content_shell_apk/ContentShellActivity.java
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.content_shell_apk;
+package org.chromium.aura_content_shell_apk;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
-import android.view.KeyEvent;
+//import android.view.KeyEvent;
import android.widget.Toast;
import org.chromium.base.BaseSwitches;
@@ -21,13 +21,10 @@ import org.chromium.base.library_loader.LibraryProcessType;
import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.content.app.ContentApplication;
import org.chromium.content.browser.BrowserStartupController;
-import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.DeviceUtils;
import org.chromium.content.common.ContentSwitches;
-import org.chromium.content_public.browser.WebContents;
import org.chromium.content_shell.Shell;
-import org.chromium.content_shell.ShellManager;
-import org.chromium.ui.base.ActivityWindowAndroid;
+
/**
* Activity for managing the Content Shell.
@@ -39,14 +36,15 @@ public class ContentShellActivity extends Activity {
private static final String ACTIVE_SHELL_URL_KEY = "activeUrl";
public static final String COMMAND_LINE_ARGS_KEY = "commandLineArgs";
- private ShellManager mShellManager;
- private ActivityWindowAndroid mWindowAndroid;
private Intent mLastSentIntent;
+ private Shell mActiveShell;
+
@Override
@SuppressFBWarnings("DM_EXIT")
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Log.w("auraclank", "ContentShellActivity.onCreate");
// Initializing the command line must occur before loading the library.
if (!CommandLine.isInitialized()) {
@@ -70,26 +68,28 @@ public class ContentShellActivity extends Activity {
return;
}
- setContentView(R.layout.content_shell_activity);
- mShellManager = (ShellManager) findViewById(R.id.shell_container);
+ // ContentView will be set by PWA
+ //setContentView(R.layout.content_shell_activity);
+// mShellManager = (ShellManager) findViewById(R.id.shell_container);
final boolean listenToActivityState = true;
- mWindowAndroid = new ActivityWindowAndroid(this, listenToActivityState);
- mWindowAndroid.restoreInstanceState(savedInstanceState);
- mShellManager.setWindow(mWindowAndroid);
+// mWindowAndroid = new ActivityWindowAndroid(this, listenToActivityState);
+// mWindowAndroid.restoreInstanceState(savedInstanceState);
+// mShellManager.setWindow(mWindowAndroid);
// Set up the animation placeholder to be the SurfaceView. This disables the
// SurfaceView's 'hole' clipping during animations that are notified to the window.
- mWindowAndroid.setAnimationPlaceholderView(
- mShellManager.getContentViewRenderView().getSurfaceView());
+// mWindowAndroid.setAnimationPlaceholderView(
+// mShellManager.getContentViewRenderView().getSurfaceView());
- String startupUrl = getUrlFromIntent(getIntent());
- if (!TextUtils.isEmpty(startupUrl)) {
- mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl));
- }
+// String startupUrl = getUrlFromIntent(getIntent());
+// if (!TextUtils.isEmpty(startupUrl)) {
+// mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl));
+// }
+ //mActiveShell
if (CommandLine.getInstance().hasSwitch(ContentSwitches.RUN_LAYOUT_TEST)
|| CommandLine.getInstance().hasSwitch(ContentSwitches.DUMP_RENDER_TREE)) {
try {
- BrowserStartupController.get(this, LibraryProcessType.PROCESS_BROWSER)
+ BrowserStartupController.get(this, LibraryProcessType.PROCESS_BROWSER, false)
.startBrowserProcessesSync(false);
} catch (ProcessInitException e) {
Log.e(TAG, "Failed to load native library.", e);
@@ -97,7 +97,7 @@ public class ContentShellActivity extends Activity {
}
} else {
try {
- BrowserStartupController.get(this, LibraryProcessType.PROCESS_BROWSER)
+ BrowserStartupController.get(this, LibraryProcessType.PROCESS_BROWSER, false)
.startBrowserProcessesAsync(
new BrowserStartupController.StartupCallback() {
@Override
@@ -107,6 +107,7 @@ public class ContentShellActivity extends Activity {
@Override
public void onFailure() {
+ Log.w("auraclank", "StartupCallback: onFailure");
initializationFailed();
}
});
@@ -118,31 +119,35 @@ public class ContentShellActivity extends Activity {
}
private void finishInitialization(Bundle savedInstanceState) {
- String shellUrl = ShellManager.DEFAULT_SHELL_URL;
- if (savedInstanceState != null
- && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) {
- shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY);
- }
- mShellManager.launchShell(shellUrl);
+ Log.w("auraclank", "ContentShellActivity finishInitialization!");
+// String shellUrl = ShellManager.DEFAULT_SHELL_URL;
+// if (savedInstanceState != null
+// && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) {
+// shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY);
+// }
+// mShellManager.launchShell(shellUrl);
}
private void initializationFailed() {
Log.e(TAG, "ContentView initialization failed.");
+ Log.e("auraclank", "ContentView initialization failed.");
Toast.makeText(ContentShellActivity.this,
- R.string.browser_process_initialization_failed,
+ //TODO(mfomitchev): string
+ "Initialization failed.",
+ //R.string.browser_process_initialization_failed,
Toast.LENGTH_SHORT).show();
finish();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- ContentViewCore contentViewCore = getActiveContentViewCore();
- if (contentViewCore != null) {
- outState.putString(ACTIVE_SHELL_URL_KEY, contentViewCore.getWebContents().getUrl());
- }
-
- mWindowAndroid.saveInstanceState(outState);
+// super.onSaveInstanceState(outState);
+// ContentViewCore contentViewCore = getActiveContentViewCore();
+// if (contentViewCore != null) {
+// outState.putString(ACTIVE_SHELL_URL_KEY, contentViewCore.getWebContents().getUrl());
+// }
+//
+// mWindowAndroid.saveInstanceState(outState);
}
private void waitForDebuggerIfNeeded() {
@@ -154,21 +159,8 @@ public class ContentShellActivity extends Activity {
}
@Override
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_BACK) {
- ContentViewCore contentViewCore = getActiveContentViewCore();
- if (contentViewCore != null && contentViewCore.getWebContents()
- .getNavigationController().canGoBack()) {
- contentViewCore.getWebContents().getNavigationController().goBack();
- return true;
- }
- }
-
- return super.onKeyUp(keyCode, event);
- }
-
- @Override
protected void onNewIntent(Intent intent) {
+ Log.e("auraclank", "ContentShellActivity.onNewIntent");
if (getCommandLineParamsFromIntent(intent) != null) {
Log.i(TAG, "Ignoring command line params: can only be set when creating the activity.");
}
@@ -177,10 +169,10 @@ public class ContentShellActivity extends Activity {
String url = getUrlFromIntent(intent);
if (!TextUtils.isEmpty(url)) {
- Shell activeView = getActiveShell();
- if (activeView != null) {
- activeView.loadUrl(url);
- }
+// Shell activeView = getActiveShell();
+// if (activeView != null) {
+// activeView.loadUrl(url);
+// }
}
}
@@ -188,14 +180,14 @@ public class ContentShellActivity extends Activity {
protected void onStart() {
super.onStart();
- ContentViewCore contentViewCore = getActiveContentViewCore();
- if (contentViewCore != null) contentViewCore.onShow();
+// ContentViewCore contentViewCore = getActiveContentViewCore();
+// if (contentViewCore != null) contentViewCore.onShow();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
- mWindowAndroid.onActivityResult(requestCode, resultCode, data);
+// mWindowAndroid.onActivityResult(requestCode, resultCode, data);
}
@Override
@@ -217,36 +209,20 @@ public class ContentShellActivity extends Activity {
}
/**
- * @return The {@link ShellManager} configured for the activity or null if it has not been
- * created yet.
- */
- public ShellManager getShellManager() {
- return mShellManager;
- }
-
- /**
* @return The currently visible {@link Shell} or null if one is not showing.
*/
public Shell getActiveShell() {
- return mShellManager != null ? mShellManager.getActiveShell() : null;
- }
-
- /**
- * @return The {@link ContentViewCore} owned by the currently visible {@link Shell} or null if
- * one is not showing.
- */
- public ContentViewCore getActiveContentViewCore() {
- Shell shell = getActiveShell();
- return shell != null ? shell.getContentViewCore() : null;
- }
-
- /**
- * @return The {@link WebContents} owned by the currently visible {@link Shell} or null if
- * one is not showing.
- */
- public WebContents getActiveWebContents() {
- Shell shell = getActiveShell();
- return shell != null ? shell.getWebContents() : null;
- }
+ return null;
+ //return mShellManager != null ? mShellManager.getActiveShell() : null;
+ }
+
+// /**
+// * @return The {@link WebContents} owned by the currently visible {@link Shell} or null if
+// * one is not showing.
+// */
+// public WebContents getActiveWebContents() {
+// Shell shell = getActiveShell();
+// return shell != null ? shell.getWebContents() : null;
+// }
}

Powered by Google App Engine
This is Rietveld 408576698