Index: content/shell/android/shell_apk/src/org/chromium/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/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java |
index 9e37370edd02c25b59d3d1bcc49abc211b91f9e2..e24835b8efd464ca607c79146964f76a26cf2d05 100644 |
--- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java |
+++ b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java |
@@ -18,7 +18,7 @@ import org.chromium.base.MemoryPressureListener; |
import org.chromium.content.app.LibraryLoader; |
import org.chromium.content.browser.ActivityContentVideoViewClient; |
import org.chromium.content.browser.AndroidBrowserProcess; |
-import org.chromium.content.browser.ContentVideoView; |
+import org.chromium.content.browser.BrowserStartupConfig; |
import org.chromium.content.browser.ContentVideoViewClient; |
import org.chromium.content.browser.ContentView; |
import org.chromium.content.browser.ContentViewClient; |
@@ -92,26 +92,45 @@ public class ContentShellActivity extends ChromiumActivity { |
if (!TextUtils.isEmpty(startupUrl)) { |
mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl)); |
} |
+ |
+ BrowserStartupConfig.setAsync(new BrowserStartupConfig.StartupCallback() { |
+ |
+ @Override |
+ public void run(int startupResult) { |
+ if (startupResult > 0) { |
+ // TODO: Show error message. |
+ Log.e(TAG, "ContentView initialization failed."); |
+ finish(); |
+ } else { |
+ finishInitialization(); |
+ } |
+ } |
+ }); |
+ |
if (!AndroidBrowserProcess.init(this, AndroidBrowserProcess.MAX_RENDERERS_LIMIT)) { |
String shellUrl = ShellManager.DEFAULT_SHELL_URL; |
if (savedInstanceState != null |
- && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) { |
+ && savedInstanceState.containsKey(ACTIVE_SHELL_URL_KEY)) { |
shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY); |
} |
mShellManager.launchShell(shellUrl); |
+ finishInitialization(); |
} |
- getActiveContentView().setContentViewClient(new ContentViewClient() { |
- @Override |
- public ContentVideoViewClient getContentVideoViewClient() { |
- return new ActivityContentVideoViewClient(ContentShellActivity.this); |
- } |
- }); |
} catch (ProcessInitException e) { |
Log.e(TAG, "ContentView initialization failed.", e); |
finish(); |
} |
} |
+ private void finishInitialization() { |
+ getActiveContentView().setContentViewClient(new ContentViewClient() { |
+ @Override |
+ public ContentVideoViewClient getContentVideoViewClient() { |
+ return new ActivityContentVideoViewClient(ContentShellActivity.this); |
+ } |
+ }); |
+ } |
+ |
@Override |
protected void onSaveInstanceState(Bundle outState) { |
super.onSaveInstanceState(outState); |