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

Side by Side Diff: chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java

Issue 11377117: Remove AppResource and unneeded resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 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.chrome.testshell; 5 package org.chromium.chrome.testshell;
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.util.Log;
12 import android.view.KeyEvent; 12 import android.view.KeyEvent;
13 13
14 import org.chromium.chrome.browser.DevToolsServer; 14 import org.chromium.chrome.browser.DevToolsServer;
15 import org.chromium.chrome.browser.TabBase; 15 import org.chromium.chrome.browser.TabBase;
16 import org.chromium.content.app.AppResource;
17 import org.chromium.content.app.LibraryLoader; 16 import org.chromium.content.app.LibraryLoader;
18 import org.chromium.content.browser.ContentView; 17 import org.chromium.content.browser.ContentView;
19 import org.chromium.content.browser.DeviceUtils; 18 import org.chromium.content.browser.DeviceUtils;
20 import org.chromium.content.common.CommandLine; 19 import org.chromium.content.common.CommandLine;
21 import org.chromium.ui.gfx.ActivityNativeWindow; 20 import org.chromium.ui.gfx.ActivityNativeWindow;
22 21
23 /** 22 /**
24 * The {@link Activity} component of a basic test shell to test Chrome features. 23 * The {@link Activity} component of a basic test shell to test Chrome features.
25 */ 24 */
26 public class ChromiumTestShellActivity extends Activity { 25 public class ChromiumTestShellActivity extends Activity {
27 private static final String TAG = ChromiumTestShellActivity.class.getCanonic alName(); 26 private static final String TAG = ChromiumTestShellActivity.class.getCanonic alName();
28 private static final String COMMAND_LINE_FILE = 27 private static final String COMMAND_LINE_FILE =
29 "/data/local/tmp/chromium-testshell-command-line"; 28 "/data/local/tmp/chromium-testshell-command-line";
30 29
31 private ActivityNativeWindow mWindow; 30 private ActivityNativeWindow mWindow;
32 private TabManager mTabManager; 31 private TabManager mTabManager;
33 private DevToolsServer mDevToolsServer; 32 private DevToolsServer mDevToolsServer;
34 33
35 @Override 34 @Override
36 protected void onCreate(Bundle savedInstanceState) { 35 protected void onCreate(Bundle savedInstanceState) {
37 super.onCreate(savedInstanceState); 36 super.onCreate(savedInstanceState);
38 37
39 if (!CommandLine.isInitialized()) CommandLine.initFromFile(COMMAND_LINE_ FILE); 38 if (!CommandLine.isInitialized()) CommandLine.initFromFile(COMMAND_LINE_ FILE);
40 waitForDebuggerIfNeeded(); 39 waitForDebuggerIfNeeded();
41 40
42 DeviceUtils.addDeviceSpecificUserAgentSwitch(this); 41 DeviceUtils.addDeviceSpecificUserAgentSwitch(this);
43 42
44 initializeContentViewResources();
45 ContentView.initChromiumBrowserProcess(this, ContentView.MAX_RENDERERS_A UTOMATIC); 43 ContentView.initChromiumBrowserProcess(this, ContentView.MAX_RENDERERS_A UTOMATIC);
46 44
47 setContentView(R.layout.testshell_activity); 45 setContentView(R.layout.testshell_activity);
48 mTabManager = (TabManager) findViewById(R.id.tab_manager); 46 mTabManager = (TabManager) findViewById(R.id.tab_manager);
49 String startupUrl = getUrlFromIntent(getIntent()); 47 String startupUrl = getUrlFromIntent(getIntent());
50 if (!TextUtils.isEmpty(startupUrl)) { 48 if (!TextUtils.isEmpty(startupUrl)) {
51 mTabManager.setStartupUrl(startupUrl); 49 mTabManager.setStartupUrl(startupUrl);
52 } 50 }
53 51
54 mWindow = new ActivityNativeWindow(this); 52 mWindow = new ActivityNativeWindow(this);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 130 }
133 131
134 private void waitForDebuggerIfNeeded() { 132 private void waitForDebuggerIfNeeded() {
135 if (CommandLine.getInstance().hasSwitch(CommandLine.WAIT_FOR_JAVA_DEBUGG ER)) { 133 if (CommandLine.getInstance().hasSwitch(CommandLine.WAIT_FOR_JAVA_DEBUGG ER)) {
136 Log.e(TAG, "Waiting for Java debugger to connect..."); 134 Log.e(TAG, "Waiting for Java debugger to connect...");
137 android.os.Debug.waitForDebugger(); 135 android.os.Debug.waitForDebugger();
138 Log.e(TAG, "Java debugger connected. Resuming execution."); 136 Log.e(TAG, "Java debugger connected. Resuming execution.");
139 } 137 }
140 } 138 }
141 139
142 private void initializeContentViewResources() {
143 AppResource.DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS = R.dimen.link_preview _overlay_radius;
144 AppResource.DRAWABLE_ICON_ACTION_BAR_SHARE = R.drawable.ic_menu_share_ho lo_light;
145 AppResource.DRAWABLE_ICON_ACTION_BAR_WEB_SEARCH = R.drawable.ic_menu_sea rch_holo_light;
146 AppResource.DRAWABLE_LINK_PREVIEW_POPUP_OVERLAY = R.drawable.popup_zoome r_overlay;
147 AppResource.ID_AUTOFILL_LABEL = R.id.autofill_label;
148 AppResource.ID_AUTOFILL_NAME = R.id.autofill_name;
149 AppResource.LAYOUT_AUTOFILL_TEXT = R.layout.autofill_text;
150 AppResource.STRING_ACTION_BAR_SHARE = R.string.action_bar_share;
151 AppResource.STRING_ACTION_BAR_WEB_SEARCH = R.string.action_bar_search;
152 AppResource.STRING_CONTENT_VIEW_CONTENT_DESCRIPTION = R.string.accessibi lity_content_view;
153 AppResource.STRING_MEDIA_PLAYER_MESSAGE_PLAYBACK_ERROR =
154 R.string.media_player_error_text_invalid_progressive_playback;
155 AppResource.STRING_MEDIA_PLAYER_MESSAGE_UNKNOWN_ERROR =
156 R.string.media_player_error_text_unknown;
157 AppResource.STRING_MEDIA_PLAYER_ERROR_BUTTON = R.string.media_player_err or_button;
158 AppResource.STRING_MEDIA_PLAYER_ERROR_TITLE = R.string.media_player_erro r_title;
159 AppResource.STRING_MEDIA_PLAYER_LOADING_VIDEO = R.string.media_player_lo ading_video;
160 }
161
162 private static String getUrlFromIntent(Intent intent) { 140 private static String getUrlFromIntent(Intent intent) {
163 return intent != null ? intent.getDataString() : null; 141 return intent != null ? intent.getDataString() : null;
164 } 142 }
165 } 143 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698