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.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.util.Log; |
12 import android.view.KeyEvent; | 12 import android.view.KeyEvent; |
13 | 13 |
14 import org.chromium.content.app.AppResource; | 14 import org.chromium.content.app.AppResource; |
15 import org.chromium.content.app.LibraryLoader; | 15 import org.chromium.content.app.LibraryLoader; |
16 import org.chromium.content.browser.ContentView; | 16 import org.chromium.content.browser.ContentView; |
| 17 import org.chromium.content.browser.DeviceUtils; |
17 import org.chromium.content.common.CommandLine; | 18 import org.chromium.content.common.CommandLine; |
18 import org.chromium.ui.gfx.ActivityNativeWindow; | 19 import org.chromium.ui.gfx.ActivityNativeWindow; |
19 | 20 |
20 /** | 21 /** |
21 * Activity for managing the Content Shell. | 22 * Activity for managing the Content Shell. |
22 */ | 23 */ |
23 public class ContentShellActivity extends Activity { | 24 public class ContentShellActivity extends Activity { |
24 | 25 |
25 private static final String COMMAND_LINE_FILE = "/data/local/tmp/content-she
ll-command-line"; | 26 private static final String COMMAND_LINE_FILE = "/data/local/tmp/content-she
ll-command-line"; |
26 private static final String TAG = ContentShellActivity.class.getName(); | 27 private static final String TAG = ContentShellActivity.class.getName(); |
(...skipping 12 matching lines...) Expand all Loading... |
39 // Initializing the command line must occur before loading the library. | 40 // Initializing the command line must occur before loading the library. |
40 if (!CommandLine.isInitialized()) { | 41 if (!CommandLine.isInitialized()) { |
41 CommandLine.initFromFile(COMMAND_LINE_FILE); | 42 CommandLine.initFromFile(COMMAND_LINE_FILE); |
42 String[] commandLineParams = getCommandLineParamsFromIntent(getInten
t()); | 43 String[] commandLineParams = getCommandLineParamsFromIntent(getInten
t()); |
43 if (commandLineParams != null) { | 44 if (commandLineParams != null) { |
44 CommandLine.getInstance().appendSwitchesAndArguments(commandLine
Params); | 45 CommandLine.getInstance().appendSwitchesAndArguments(commandLine
Params); |
45 } | 46 } |
46 } | 47 } |
47 waitForDebuggerIfNeeded(); | 48 waitForDebuggerIfNeeded(); |
48 | 49 |
| 50 DeviceUtils.addDeviceSpecificUserAgentSwitch(this); |
| 51 |
49 LibraryLoader.loadAndInitSync(); | 52 LibraryLoader.loadAndInitSync(); |
50 initializeContentViewResources(); | 53 initializeContentViewResources(); |
51 | 54 |
52 setContentView(R.layout.content_shell_activity); | 55 setContentView(R.layout.content_shell_activity); |
53 mShellManager = (ShellManager) findViewById(R.id.shell_container); | 56 mShellManager = (ShellManager) findViewById(R.id.shell_container); |
54 mActivityNativeWindow = new ActivityNativeWindow(this); | 57 mActivityNativeWindow = new ActivityNativeWindow(this); |
55 mActivityNativeWindow.restoreInstanceState(savedInstanceState); | 58 mActivityNativeWindow.restoreInstanceState(savedInstanceState); |
56 mShellManager.setWindow(mActivityNativeWindow); | 59 mShellManager.setWindow(mActivityNativeWindow); |
57 | 60 |
58 String startupUrl = getUrlFromIntent(getIntent()); | 61 String startupUrl = getUrlFromIntent(getIntent()); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 AppResource.STRING_ACTION_BAR_WEB_SEARCH = R.string.action_bar_search; | 183 AppResource.STRING_ACTION_BAR_WEB_SEARCH = R.string.action_bar_search; |
181 AppResource.STRING_CONTENT_VIEW_CONTENT_DESCRIPTION = R.string.accessibi
lity_content_view; | 184 AppResource.STRING_CONTENT_VIEW_CONTENT_DESCRIPTION = R.string.accessibi
lity_content_view; |
182 AppResource.STRING_MEDIA_PLAYER_MESSAGE_PLAYBACK_ERROR = | 185 AppResource.STRING_MEDIA_PLAYER_MESSAGE_PLAYBACK_ERROR = |
183 R.string.media_player_error_text_invalid_progressive_playback; | 186 R.string.media_player_error_text_invalid_progressive_playback; |
184 AppResource.STRING_MEDIA_PLAYER_MESSAGE_UNKNOWN_ERROR = | 187 AppResource.STRING_MEDIA_PLAYER_MESSAGE_UNKNOWN_ERROR = |
185 R.string.media_player_error_text_unknown; | 188 R.string.media_player_error_text_unknown; |
186 AppResource.STRING_MEDIA_PLAYER_ERROR_BUTTON = R.string.media_player_err
or_button; | 189 AppResource.STRING_MEDIA_PLAYER_ERROR_BUTTON = R.string.media_player_err
or_button; |
187 AppResource.STRING_MEDIA_PLAYER_ERROR_TITLE = R.string.media_player_erro
r_title; | 190 AppResource.STRING_MEDIA_PLAYER_ERROR_TITLE = R.string.media_player_erro
r_title; |
188 } | 191 } |
189 } | 192 } |
OLD | NEW |