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

Side by Side Diff: content/shell/android/java/org/chromium/content_shell/ContentShellActivity.java

Issue 10377059: Android content shell bringup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix deps so builds on clean machine Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content_shell; 5 package org.chromium.content_shell;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.Intent; 8 import android.content.Intent;
9 import android.os.Bundle; 9 import android.os.Bundle;
10 import android.os.Debug;
10 import android.text.TextUtils; 11 import android.text.TextUtils;
11 import android.util.Log; 12 import android.util.Log;
12 import android.view.KeyEvent; 13 import android.view.KeyEvent;
13 14
15 import org.chromium.content.browser.CommandLine;
14 import org.chromium.content.browser.ContentView; 16 import org.chromium.content.browser.ContentView;
17 import org.chromium.content.browser.LibraryLoader;
15 18
16 /** 19 /**
17 * Activity for managing the Content Shell. 20 * Activity for managing the Content Shell.
18 */ 21 */
19 public class ContentShellActivity extends Activity { 22 public class ContentShellActivity extends Activity {
20 23
21 private static final String COMMAND_LINE_FILE = "/data/local/content-shell-c ommand-line"; 24 private static final String COMMAND_LINE_FILE = "/data/local/content-shell-c ommand-line";
22 private static final String TAG = "ContentShellActivity"; 25 private static final String TAG = "ContentShellActivity";
26 private static final String NATIVE_LIBRARY = "content_shell_content_view";
23 27
24 private ShellManager mShellManager; 28 private ShellManager mShellManager;
25 29
26 @Override 30 @Override
27 protected void onCreate(Bundle savedInstanceState) { 31 protected void onCreate(Bundle savedInstanceState) {
28 super.onCreate(savedInstanceState); 32 super.onCreate(savedInstanceState);
29 33
30 // Initializing the command line must occur before loading the library. 34 // Initializing the command line must occur before loading the library.
31 // TODO(tedchoc): Initialize command line from file. 35 CommandLine.initFromFile(COMMAND_LINE_FILE);
32 String startupUrl = getUrlFromIntent(getIntent()); 36 String startupUrl = getUrlFromIntent(getIntent());
33 if (!TextUtils.isEmpty(startupUrl)) { 37 if (!TextUtils.isEmpty(startupUrl)) {
34 // TODO(tedchoc): Append URL to command line. 38 CommandLine.getInstance().appendSwitchesAndArguments(
39 new String[] {ShellView.sanitizeUrl(startupUrl)});
35 } 40 }
36 41
37 // TODO(jrg,tedchoc): upstream the async library loader, then 42 // TODO(jrg): once command line support is addef (for
38 // make this call look like this: 43 // --wait-for-debugger), remove this.
39 // LibraryLoader.loadAndInitSync(); 44 // Debug.waitForDebugger();
40 loadNativeLibrary(); 45 LibraryLoader.loadAndInitSync();
41
42 initializeContentViewResources(); 46 initializeContentViewResources();
43 47
44 setContentView(R.layout.content_shell_activity); 48 setContentView(R.layout.content_shell_activity);
45 mShellManager = (ShellManager) findViewById(R.id.shell_container); 49 mShellManager = (ShellManager) findViewById(R.id.shell_container);
46 ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_AUTOMATIC ); 50 ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_AUTOMATIC );
47 } 51 }
48 52
49 @Override 53 @Override
50 public boolean onKeyUp(int keyCode, KeyEvent event) { 54 public boolean onKeyUp(int keyCode, KeyEvent event) {
51 if (keyCode != KeyEvent.KEYCODE_BACK) return super.onKeyUp(keyCode, even t); 55 if (keyCode != KeyEvent.KEYCODE_BACK) return super.onKeyUp(keyCode, even t);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 * @return The currently visible {@link ShellView} or null if one is not sho wing. 90 * @return The currently visible {@link ShellView} or null if one is not sho wing.
87 */ 91 */
88 public ShellView getActiveShellView() { 92 public ShellView getActiveShellView() {
89 return mShellManager != null ? mShellManager.getActiveShellView() : null ; 93 return mShellManager != null ? mShellManager.getActiveShellView() : null ;
90 } 94 }
91 95
92 private void initializeContentViewResources() { 96 private void initializeContentViewResources() {
93 ContentView.registerPopupOverlayCornerRadius(0); 97 ContentView.registerPopupOverlayCornerRadius(0);
94 ContentView.registerPopupOverlayResourceId(R.drawable.popup_zoomer_overl ay); 98 ContentView.registerPopupOverlayResourceId(R.drawable.popup_zoomer_overl ay);
95 } 99 }
96
97
98 private static final String NATIVE_LIBRARY = "content_shell_content_view";
99
100 private void loadNativeLibrary() throws UnsatisfiedLinkError {
101 Log.i(TAG, "loading: " + NATIVE_LIBRARY);
102 try {
103 System.loadLibrary(NATIVE_LIBRARY);
104 } catch (UnsatisfiedLinkError e) {
105 Log.e(TAG, "Unable to load lib" + NATIVE_LIBRARY + ".so: " + e);
106 throw e;
107 }
108 Log.i(TAG, "loaded: " + NATIVE_LIBRARY);
109 }
110 } 100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698