| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.chromecast.shell; | 5 package org.chromium.chromecast.shell; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.os.Debug; | 10 import android.os.Debug; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 CommandLine.getInstance().appendSwitchesAndArguments(command
LineParams); | 56 CommandLine.getInstance().appendSwitchesAndArguments(command
LineParams); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 waitForDebuggerIfNeeded(); | 61 waitForDebuggerIfNeeded(); |
| 62 | 62 |
| 63 DeviceUtils.addDeviceSpecificUserAgentSwitch(context); | 63 DeviceUtils.addDeviceSpecificUserAgentSwitch(context); |
| 64 | 64 |
| 65 try { | 65 try { |
| 66 LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitiali
zed(context); | 66 LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitiali
zed(); |
| 67 | 67 |
| 68 Log.d(TAG, "Loading BrowserStartupController..."); | 68 Log.d(TAG, "Loading BrowserStartupController..."); |
| 69 BrowserStartupController.get(context, LibraryProcessType.PROCESS_BRO
WSER) | 69 BrowserStartupController.get(context, LibraryProcessType.PROCESS_BRO
WSER) |
| 70 .startBrowserProcessesSync(false); | 70 .startBrowserProcessesSync(false); |
| 71 NetworkChangeNotifier.init(context); | 71 NetworkChangeNotifier.init(context); |
| 72 // Cast shell always expects to receive notifications to track netwo
rk state. | 72 // Cast shell always expects to receive notifications to track netwo
rk state. |
| 73 NetworkChangeNotifier.registerToReceiveNotificationsAlways(); | 73 NetworkChangeNotifier.registerToReceiveNotificationsAlways(); |
| 74 sIsBrowserInitialized = true; | 74 sIsBrowserInitialized = true; |
| 75 return true; | 75 return true; |
| 76 } catch (ProcessInitException e) { | 76 } catch (ProcessInitException e) { |
| 77 Log.e(TAG, "Unable to launch browser process.", e); | 77 Log.e(TAG, "Unable to launch browser process.", e); |
| 78 return false; | 78 return false; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 private static String[] getCommandLineParamsFromIntent(Intent intent) { | 82 private static String[] getCommandLineParamsFromIntent(Intent intent) { |
| 83 return intent != null ? intent.getStringArrayExtra(COMMAND_LINE_ARGS_KEY
) : null; | 83 return intent != null ? intent.getStringArrayExtra(COMMAND_LINE_ARGS_KEY
) : null; |
| 84 } | 84 } |
| 85 | 85 |
| 86 private static void waitForDebuggerIfNeeded() { | 86 private static void waitForDebuggerIfNeeded() { |
| 87 if (!CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBU
GGER)) { | 87 if (!CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBU
GGER)) { |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 Log.e(TAG, "Waiting for Java debugger to connect..."); | 90 Log.e(TAG, "Waiting for Java debugger to connect..."); |
| 91 Debug.waitForDebugger(); | 91 Debug.waitForDebugger(); |
| 92 Log.e(TAG, "Java debugger connected. Resuming execution."); | 92 Log.e(TAG, "Java debugger connected. Resuming execution."); |
| 93 } | 93 } |
| 94 } | 94 } |
| OLD | NEW |