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

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

Issue 1469803006: NOT FOR REVIEW: Aura Android: Content Shell compiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@auraclank_upstream_wthandroid
Patch Set: Temp Created 5 years 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 53%
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 bfa3a16858f9d92815abbf0fd2ad49304b9a24ab..5c590d8b47ac32ee49f11ebe8051635de3e39c95 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,16 +2,16 @@
// 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.widget.Toast;
+import org.chromium.aura_content_shell.Shell;
import org.chromium.base.BaseSwitches;
import org.chromium.base.CommandLine;
import org.chromium.base.MemoryPressureListener;
@@ -21,13 +21,9 @@ 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.
@@ -36,17 +32,17 @@ public class ContentShellActivity extends Activity {
private static final String TAG = "ContentShellActivity";
- 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,23 +66,13 @@ public class ContentShellActivity extends Activity {
return;
}
- 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);
- // 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());
-
- String startupUrl = getUrlFromIntent(getIntent());
- if (!TextUtils.isEmpty(startupUrl)) {
- mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl));
- }
-
- if (CommandLine.getInstance().hasSwitch(ContentSwitches.RUN_LAYOUT_TEST)) {
+ mActiveShell = new Shell(this);
+ // ContentView will be set by PWA
+ // TODO(mfomitchev): Add ContentSwitches for Android Aura
+ boolean startBrowserProcessesSync = false;
+// CommandLine.getInstance().hasSwitch(ContentSwitches.RUN_LAYOUT_TEST)
+// || CommandLine.getInstance().hasSwitch(ContentSwitches.DUMP_RENDER_TREE);
+ if (startBrowserProcessesSync) {
try {
BrowserStartupController.get(this, LibraryProcessType.PROCESS_BROWSER)
.startBrowserProcessesSync(false);
@@ -106,6 +92,7 @@ public class ContentShellActivity extends Activity {
@Override
public void onFailure() {
+ Log.w("auraclank", "StartupCallback: onFailure");
initializationFailed();
}
});
@@ -117,33 +104,20 @@ 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!");
}
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);
- }
-
private void waitForDebuggerIfNeeded() {
if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUGGER)) {
Log.e(TAG, "Waiting for Java debugger to connect...");
@@ -153,21 +127,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.");
}
@@ -175,26 +136,6 @@ public class ContentShellActivity extends Activity {
if (MemoryPressureListener.handleDebugIntent(this, intent.getAction())) return;
String url = getUrlFromIntent(intent);
- if (!TextUtils.isEmpty(url)) {
- Shell activeView = getActiveShell();
- if (activeView != null) {
- activeView.loadUrl(url);
- }
- }
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- 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);
}
@Override
@@ -214,38 +155,4 @@ public class ContentShellActivity extends Activity {
private static String[] getCommandLineParamsFromIntent(Intent intent) {
return intent != null ? intent.getStringArrayExtra(COMMAND_LINE_ARGS_KEY) : null;
}
-
- /**
- * @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;
- }
-
}

Powered by Google App Engine
This is Rietveld 408576698