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

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

Issue 10223007: Package and load native library in content shell. Add content shell util scripts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nilesh tweak Created 8 years, 8 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
« no previous file with comments | « content/shell/android/content_shell_apk.xml ('k') | testing/android/native_test_apk.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.text.TextUtils; 10 import android.text.TextUtils;
11 import android.util.Log;
11 import android.view.KeyEvent; 12 import android.view.KeyEvent;
12 13
13 import org.chromium.content.browser.ContentView; 14 import org.chromium.content.browser.ContentView;
14 15
15 /** 16 /**
16 * Activity for managing the Content Shell. 17 * Activity for managing the Content Shell.
17 */ 18 */
18 public class ContentShellActivity extends Activity { 19 public class ContentShellActivity extends Activity {
19 20
20 private static final String COMMAND_LINE_FILE = "/data/local/content-shell-c ommand-line"; 21 private static final String COMMAND_LINE_FILE = "/data/local/content-shell-c ommand-line";
22 private static final String TAG = "ContentShellActivity";
21 23
22 private ShellManager mShellManager; 24 private ShellManager mShellManager;
23 25
24 @Override 26 @Override
25 protected void onCreate(Bundle savedInstanceState) { 27 protected void onCreate(Bundle savedInstanceState) {
26 super.onCreate(savedInstanceState); 28 super.onCreate(savedInstanceState);
27 29
28 // Initializing the command line must occur before loading the library. 30 // Initializing the command line must occur before loading the library.
29 // TODO(tedchoc): Initialize command line from file. 31 // TODO(tedchoc): Initialize command line from file.
30 String startupUrl = getUrlFromIntent(getIntent()); 32 String startupUrl = getUrlFromIntent(getIntent());
31 if (!TextUtils.isEmpty(startupUrl)) { 33 if (!TextUtils.isEmpty(startupUrl)) {
32 // TODO(tedchoc): Append URL to command line. 34 // TODO(tedchoc): Append URL to command line.
33 } 35 }
34 36
35 // TODO(tedchoc): Load the native library. 37 // TODO(jrg,tedchoc): upstream the async library loader, then
38 // make this call look like this:
39 // LibraryLoader.loadAndInitSync();
40 loadNativeLibrary();
41
36 initializeContentViewResources(); 42 initializeContentViewResources();
37 43
38 setContentView(R.layout.content_shell_activity); 44 setContentView(R.layout.content_shell_activity);
39 mShellManager = (ShellManager) findViewById(R.id.shell_container); 45 mShellManager = (ShellManager) findViewById(R.id.shell_container);
40 ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_AUTOMATIC ); 46 ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_AUTOMATIC );
41 } 47 }
42 48
43 @Override 49 @Override
44 public boolean onKeyUp(int keyCode, KeyEvent event) { 50 public boolean onKeyUp(int keyCode, KeyEvent event) {
45 if (keyCode != KeyEvent.KEYCODE_BACK) return super.onKeyUp(keyCode, even t); 51 if (keyCode != KeyEvent.KEYCODE_BACK) return super.onKeyUp(keyCode, even t);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 * @return The currently visible {@link ShellView} or null if one is not sho wing. 86 * @return The currently visible {@link ShellView} or null if one is not sho wing.
81 */ 87 */
82 public ShellView getActiveShellView() { 88 public ShellView getActiveShellView() {
83 return mShellManager != null ? mShellManager.getActiveShellView() : null ; 89 return mShellManager != null ? mShellManager.getActiveShellView() : null ;
84 } 90 }
85 91
86 private void initializeContentViewResources() { 92 private void initializeContentViewResources() {
87 ContentView.registerPopupOverlayCornerRadius(0); 93 ContentView.registerPopupOverlayCornerRadius(0);
88 ContentView.registerPopupOverlayResourceId(R.drawable.popup_zoomer_overl ay); 94 ContentView.registerPopupOverlayResourceId(R.drawable.popup_zoomer_overl ay);
89 } 95 }
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 }
90 } 110 }
OLDNEW
« no previous file with comments | « content/shell/android/content_shell_apk.xml ('k') | testing/android/native_test_apk.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698