OLD | NEW |
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.TabBase; | 14 import org.chromium.chrome.browser.TabBase; |
15 import org.chromium.content.app.AppResource; | 15 import org.chromium.content.app.AppResource; |
16 import org.chromium.content.app.LibraryLoader; | 16 import org.chromium.content.app.LibraryLoader; |
17 import org.chromium.content.browser.ContentView; | 17 import org.chromium.content.browser.ContentView; |
| 18 import org.chromium.content.browser.DeviceUtils; |
18 import org.chromium.content.common.CommandLine; | 19 import org.chromium.content.common.CommandLine; |
19 import org.chromium.ui.gfx.ActivityNativeWindow; | 20 import org.chromium.ui.gfx.ActivityNativeWindow; |
20 | 21 |
21 /** | 22 /** |
22 * 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. |
23 */ | 24 */ |
24 public class ChromiumTestShellActivity extends Activity { | 25 public class ChromiumTestShellActivity extends Activity { |
25 private static final String TAG = ChromiumTestShellActivity.class.getCanonic
alName(); | 26 private static final String TAG = ChromiumTestShellActivity.class.getCanonic
alName(); |
26 private static final String COMMAND_LINE_FILE = | 27 private static final String COMMAND_LINE_FILE = |
27 "/data/local/tmp/chrome-test-shell-command-line"; | 28 "/data/local/tmp/chrome-test-shell-command-line"; |
28 | 29 |
29 private ActivityNativeWindow mWindow; | 30 private ActivityNativeWindow mWindow; |
30 private TabManager mTabManager; | 31 private TabManager mTabManager; |
31 | 32 |
32 @Override | 33 @Override |
33 protected void onCreate(Bundle savedInstanceState) { | 34 protected void onCreate(Bundle savedInstanceState) { |
34 super.onCreate(savedInstanceState); | 35 super.onCreate(savedInstanceState); |
35 | 36 |
36 if (!CommandLine.isInitialized()) CommandLine.initFromFile(COMMAND_LINE_
FILE); | 37 if (!CommandLine.isInitialized()) CommandLine.initFromFile(COMMAND_LINE_
FILE); |
37 waitForDebuggerIfNeeded(); | 38 waitForDebuggerIfNeeded(); |
38 | 39 |
| 40 DeviceUtils.addDeviceSpecificUserAgentSwitch(this); |
| 41 |
39 initializeContentViewResources(); | 42 initializeContentViewResources(); |
40 ContentView.initChromiumBrowserProcess(this, ContentView.MAX_RENDERERS_A
UTOMATIC); | 43 ContentView.initChromiumBrowserProcess(this, ContentView.MAX_RENDERERS_A
UTOMATIC); |
41 | 44 |
42 setContentView(R.layout.testshell_activity); | 45 setContentView(R.layout.testshell_activity); |
43 mTabManager = (TabManager) findViewById(R.id.tab_manager); | 46 mTabManager = (TabManager) findViewById(R.id.tab_manager); |
44 | 47 |
45 mWindow = new ActivityNativeWindow(this); | 48 mWindow = new ActivityNativeWindow(this); |
46 mWindow.restoreInstanceState(savedInstanceState); | 49 mWindow.restoreInstanceState(savedInstanceState); |
47 mTabManager.setWindow(mWindow); | 50 mTabManager.setWindow(mWindow); |
48 } | 51 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 private void initializeContentViewResources() { | 119 private void initializeContentViewResources() { |
117 AppResource.DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS = R.dimen.link_preview
_overlay_radius; | 120 AppResource.DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS = R.dimen.link_preview
_overlay_radius; |
118 AppResource.DRAWABLE_LINK_PREVIEW_POPUP_OVERLAY = R.drawable.popup_zoome
r_overlay; | 121 AppResource.DRAWABLE_LINK_PREVIEW_POPUP_OVERLAY = R.drawable.popup_zoome
r_overlay; |
119 AppResource.STRING_CONTENT_VIEW_CONTENT_DESCRIPTION = R.string.accessibi
lity_content_view; | 122 AppResource.STRING_CONTENT_VIEW_CONTENT_DESCRIPTION = R.string.accessibi
lity_content_view; |
120 } | 123 } |
121 | 124 |
122 private static String getUrlFromIntent(Intent intent) { | 125 private static String getUrlFromIntent(Intent intent) { |
123 return intent != null ? intent.getDataString() : null; | 126 return intent != null ? intent.getDataString() : null; |
124 } | 127 } |
125 } | 128 } |
OLD | NEW |