Chromium Code Reviews| Index: chrome/browser/ui/ash/cast_config_delegate_chromeos.cc |
| diff --git a/chrome/browser/ui/ash/cast_config_delegate_chromeos.cc b/chrome/browser/ui/ash/cast_config_delegate_chromeos.cc |
| index b2196e97705e01ef346d7214d2696d8168ced72f..c97aeea96c7f273993f472b462b72df8ccb99d40 100644 |
| --- a/chrome/browser/ui/ash/cast_config_delegate_chromeos.cc |
| +++ b/chrome/browser/ui/ash/cast_config_delegate_chromeos.cc |
| @@ -127,26 +127,32 @@ bool CastConfigDelegateChromeos::HasCastExtension() const { |
| void CastConfigDelegateChromeos::GetReceiversAndActivities( |
| const ReceiversAndActivitesCallback& callback) { |
| + // The extension API methods are exported to the global namespace, not to |
| + // backgroundSetup, even though they are conceptually methods on |
| + // backgroundSetup. This means that to invoke the exported methods, we |
| + // have to manually bind the this argument using call (versus doing the |
| + // more expected backgroundSetup.getMirrorCapable...()). |
|
achuithb
2015/06/05 23:46:49
Hmm, how about something more along the lines of:
|
| ExecuteJavaScriptWithCallback( |
| - "backgroundSetup.getMirrorCapableReceiversAndActivities();", |
| + "getMirrorCapableReceiversAndActivities.call(backgroundSetup);", |
| base::Bind(&GetReceiversAndActivitiesCallback, callback)); |
| } |
| void CastConfigDelegateChromeos::CastToReceiver( |
| const std::string& receiver_id) { |
| - ExecuteJavaScript("backgroundSetup.launchDesktopMirroring('" + receiver_id + |
| - "');"); |
| + // See comment in GetReceiversAndActivities. |
| + ExecuteJavaScript("launchDesktopMirroring.call(backgroundSetup, '" + |
| + receiver_id + "');"); |
| } |
| void CastConfigDelegateChromeos::StopCasting() { |
| - ExecuteJavaScript("backgroundSetup.stopMirroring('user-stop')"); |
| - |
| + // See comment in GetReceiversAndActivities. |
| // TODO(jdufault): Remove this after the beta/release versions of the |
| // cast extension have been updated so that they properly export the |
| // stopMirroring function. For now, we try to invoke all of the other |
| // names that the function goes by. See crbug.com/489929. |
| - ExecuteJavaScript("backgroundSetup.stopCastMirroring('user-stop');"); |
| ExecuteJavaScript("backgroundSetup.Qu('user-stop');"); |
| + ExecuteJavaScript("stopCastMirroring.call(backgroundSetup, 'user-stop');"); |
| + ExecuteJavaScript("stopMirroring.call(backgroundSetup, 'user-stop');"); |
| } |
| void CastConfigDelegateChromeos::LaunchCastOptions() { |