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; | |
15 import org.chromium.content.app.LibraryLoader; | 14 import org.chromium.content.app.LibraryLoader; |
16 import org.chromium.content.browser.ContentVideoView; | 15 import org.chromium.content.browser.ContentVideoView; |
17 import org.chromium.content.browser.ContentView; | 16 import org.chromium.content.browser.ContentView; |
18 import org.chromium.content.browser.DeviceUtils; | 17 import org.chromium.content.browser.DeviceUtils; |
19 import org.chromium.content.common.CommandLine; | 18 import org.chromium.content.common.CommandLine; |
20 import org.chromium.ui.gfx.ActivityNativeWindow; | 19 import org.chromium.ui.gfx.ActivityNativeWindow; |
21 | 20 |
22 /** | 21 /** |
23 * Activity for managing the Content Shell. | 22 * Activity for managing the Content Shell. |
24 */ | 23 */ |
(...skipping 19 matching lines...) Expand all Loading... |
44 String[] commandLineParams = getCommandLineParamsFromIntent(getInten
t()); | 43 String[] commandLineParams = getCommandLineParamsFromIntent(getInten
t()); |
45 if (commandLineParams != null) { | 44 if (commandLineParams != null) { |
46 CommandLine.getInstance().appendSwitchesAndArguments(commandLine
Params); | 45 CommandLine.getInstance().appendSwitchesAndArguments(commandLine
Params); |
47 } | 46 } |
48 } | 47 } |
49 waitForDebuggerIfNeeded(); | 48 waitForDebuggerIfNeeded(); |
50 | 49 |
51 DeviceUtils.addDeviceSpecificUserAgentSwitch(this); | 50 DeviceUtils.addDeviceSpecificUserAgentSwitch(this); |
52 | 51 |
53 LibraryLoader.ensureInitialized(); | 52 LibraryLoader.ensureInitialized(); |
54 initializeContentViewResources(); | |
55 | 53 |
56 setContentView(R.layout.content_shell_activity); | 54 setContentView(R.layout.content_shell_activity); |
57 mShellManager = (ShellManager) findViewById(R.id.shell_container); | 55 mShellManager = (ShellManager) findViewById(R.id.shell_container); |
58 mActivityNativeWindow = new ActivityNativeWindow(this); | 56 mActivityNativeWindow = new ActivityNativeWindow(this); |
59 mActivityNativeWindow.restoreInstanceState(savedInstanceState); | 57 mActivityNativeWindow.restoreInstanceState(savedInstanceState); |
60 mShellManager.setWindow(mActivityNativeWindow); | 58 mShellManager.setWindow(mActivityNativeWindow); |
61 ContentVideoView.registerChromeActivity(this); | 59 ContentVideoView.registerChromeActivity(this); |
62 | 60 |
63 String startupUrl = getUrlFromIntent(getIntent()); | 61 String startupUrl = getUrlFromIntent(getIntent()); |
64 if (!TextUtils.isEmpty(startupUrl)) { | 62 if (!TextUtils.isEmpty(startupUrl)) { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 166 } |
169 | 167 |
170 /** | 168 /** |
171 * @return The {@link ContentView} owned by the currently visible {@link She
ll} or null if one | 169 * @return The {@link ContentView} owned by the currently visible {@link She
ll} or null if one |
172 * is not showing. | 170 * is not showing. |
173 */ | 171 */ |
174 public ContentView getActiveContentView() { | 172 public ContentView getActiveContentView() { |
175 Shell shell = getActiveShell(); | 173 Shell shell = getActiveShell(); |
176 return shell != null ? shell.getContentView() : null; | 174 return shell != null ? shell.getContentView() : null; |
177 } | 175 } |
178 | |
179 private void initializeContentViewResources() { | |
180 AppResource.DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS = R.dimen.link_preview
_overlay_radius; | |
181 AppResource.DRAWABLE_ICON_ACTION_BAR_SHARE = R.drawable.ic_menu_share_ho
lo_light; | |
182 AppResource.DRAWABLE_ICON_ACTION_BAR_WEB_SEARCH = R.drawable.ic_menu_sea
rch_holo_light; | |
183 AppResource.DRAWABLE_LINK_PREVIEW_POPUP_OVERLAY = R.drawable.popup_zoome
r_overlay; | |
184 AppResource.STRING_ACTION_BAR_SHARE = R.string.action_bar_share; | |
185 AppResource.STRING_ACTION_BAR_WEB_SEARCH = R.string.action_bar_search; | |
186 AppResource.STRING_CONTENT_VIEW_CONTENT_DESCRIPTION = R.string.accessibi
lity_content_view; | |
187 AppResource.STRING_MEDIA_PLAYER_MESSAGE_PLAYBACK_ERROR = | |
188 R.string.media_player_error_text_invalid_progressive_playback; | |
189 AppResource.STRING_MEDIA_PLAYER_MESSAGE_UNKNOWN_ERROR = | |
190 R.string.media_player_error_text_unknown; | |
191 AppResource.STRING_MEDIA_PLAYER_ERROR_BUTTON = R.string.media_player_err
or_button; | |
192 AppResource.STRING_MEDIA_PLAYER_ERROR_TITLE = R.string.media_player_erro
r_title; | |
193 AppResource.STRING_MEDIA_PLAYER_LOADING_VIDEO = R.string.media_player_lo
ading_video; | |
194 } | |
195 } | 176 } |
OLD | NEW |