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

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

Issue 10800019: Refactor ContentShell to remove ContentViewClient dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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.text.TextUtils; 10 import android.text.TextUtils;
(...skipping 17 matching lines...) Expand all
28 28
29 @Override 29 @Override
30 protected void onCreate(Bundle savedInstanceState) { 30 protected void onCreate(Bundle savedInstanceState) {
31 super.onCreate(savedInstanceState); 31 super.onCreate(savedInstanceState);
32 32
33 // Initializing the command line must occur before loading the library. 33 // Initializing the command line must occur before loading the library.
34 CommandLine.initFromFile(COMMAND_LINE_FILE); 34 CommandLine.initFromFile(COMMAND_LINE_FILE);
35 String startupUrl = getUrlFromIntent(getIntent()); 35 String startupUrl = getUrlFromIntent(getIntent());
36 if (!TextUtils.isEmpty(startupUrl)) { 36 if (!TextUtils.isEmpty(startupUrl)) {
37 CommandLine.getInstance().appendSwitchesAndArguments( 37 CommandLine.getInstance().appendSwitchesAndArguments(
38 new String[] {ShellView.sanitizeUrl(startupUrl)}); 38 new String[] {Shell.sanitizeUrl(startupUrl)});
39 } 39 }
40 waitForDebuggerIfNeeded(); 40 waitForDebuggerIfNeeded();
41 41
42 LibraryLoader.loadAndInitSync(); 42 LibraryLoader.loadAndInitSync();
43 initializeContentViewResources(); 43 initializeContentViewResources();
44 44
45 setContentView(R.layout.content_shell_activity); 45 setContentView(R.layout.content_shell_activity);
46 mShellManager = (ShellManager) findViewById(R.id.shell_container); 46 mShellManager = (ShellManager) findViewById(R.id.shell_container);
47 ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_AUTOMATIC ); 47 ContentView.enableMultiProcess(this, ContentView.MAX_RENDERERS_AUTOMATIC );
48 } 48 }
49 49
50 private void waitForDebuggerIfNeeded() { 50 private void waitForDebuggerIfNeeded() {
51 if (CommandLine.getInstance().hasSwitch(CommandLine.WAIT_FOR_JAVA_DEBUGG ER)) { 51 if (CommandLine.getInstance().hasSwitch(CommandLine.WAIT_FOR_JAVA_DEBUGG ER)) {
52 Log.e(TAG, "Waiting for Java debugger to connect..."); 52 Log.e(TAG, "Waiting for Java debugger to connect...");
53 android.os.Debug.waitForDebugger(); 53 android.os.Debug.waitForDebugger();
54 Log.e(TAG, "Java debugger connected. Resuming execution."); 54 Log.e(TAG, "Java debugger connected. Resuming execution.");
55 } 55 }
56 } 56 }
57 57
58 @Override 58 @Override
59 public boolean onKeyUp(int keyCode, KeyEvent event) { 59 public boolean onKeyUp(int keyCode, KeyEvent event) {
60 if (keyCode != KeyEvent.KEYCODE_BACK) return super.onKeyUp(keyCode, even t); 60 if (keyCode != KeyEvent.KEYCODE_BACK) return super.onKeyUp(keyCode, even t);
61 61
62 ShellView activeView = getActiveShellView(); 62 Shell activeView = getActiveShell();
63 if (activeView != null && activeView.getContentView().canGoBack()) { 63 if (activeView != null && activeView.getContentView().canGoBack()) {
64 activeView.getContentView().goBack(); 64 activeView.getContentView().goBack();
65 return true; 65 return true;
66 } 66 }
67 67
68 return super.onKeyUp(keyCode, event); 68 return super.onKeyUp(keyCode, event);
69 } 69 }
70 70
71 @Override 71 @Override
72 protected void onNewIntent(Intent intent) { 72 protected void onNewIntent(Intent intent) {
73 String url = getUrlFromIntent(intent); 73 String url = getUrlFromIntent(intent);
74 if (!TextUtils.isEmpty(url)) { 74 if (!TextUtils.isEmpty(url)) {
75 ShellView activeView = getActiveShellView(); 75 Shell activeView = getActiveShell();
76 if (activeView != null) { 76 if (activeView != null) {
77 activeView.loadUrl(url); 77 activeView.loadUrl(url);
78 } 78 }
79 } 79 }
80 } 80 }
81 81
82 private static String getUrlFromIntent(Intent intent) { 82 private static String getUrlFromIntent(Intent intent) {
83 return intent != null ? intent.getDataString() : null; 83 return intent != null ? intent.getDataString() : null;
84 } 84 }
85 85
86 /** 86 /**
87 * @return The {@link ShellManager} configured for the activity or null if i t has not been 87 * @return The {@link ShellManager} configured for the activity or null if i t has not been
88 * created yet. 88 * created yet.
89 */ 89 */
90 public ShellManager getShellManager() { 90 public ShellManager getShellManager() {
91 return mShellManager; 91 return mShellManager;
92 } 92 }
93 93
94 /** 94 /**
95 * @return The currently visible {@link ShellView} or null if one is not sho wing. 95 * @return The currently visible {@link Shell} or null if one is not showing .
96 */ 96 */
97 public ShellView getActiveShellView() { 97 public Shell getActiveShell() {
98 return mShellManager != null ? mShellManager.getActiveShellView() : null ; 98 return mShellManager != null ? mShellManager.getActiveShell() : null;
99 } 99 }
100 100
101 private void initializeContentViewResources() { 101 private void initializeContentViewResources() {
102 AppResource.DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS = R.dimen.link_preview _overlay_radius; 102 AppResource.DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS = R.dimen.link_preview _overlay_radius;
103 AppResource.DRAWABLE_LINK_PREVIEW_POPUP_OVERLAY = R.drawable.popup_zoome r_overlay; 103 AppResource.DRAWABLE_LINK_PREVIEW_POPUP_OVERLAY = R.drawable.popup_zoome r_overlay;
104 } 104 }
105 } 105 }
OLDNEW
« no previous file with comments | « content/content_shell.gypi ('k') | content/shell/android/java/src/org/chromium/content_shell/Shell.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698