OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "chrome/browser/ui/ash/cast_config_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/cast_config_delegate_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 base::Bind(&GetReceiversAndActivitiesCallback, callback)); | 132 base::Bind(&GetReceiversAndActivitiesCallback, callback)); |
133 } | 133 } |
134 | 134 |
135 void CastConfigDelegateChromeos::CastToReceiver( | 135 void CastConfigDelegateChromeos::CastToReceiver( |
136 const std::string& receiver_id) { | 136 const std::string& receiver_id) { |
137 ExecuteJavaScript("backgroundSetup.launchDesktopMirroring('" + receiver_id + | 137 ExecuteJavaScript("backgroundSetup.launchDesktopMirroring('" + receiver_id + |
138 "');"); | 138 "');"); |
139 } | 139 } |
140 | 140 |
141 void CastConfigDelegateChromeos::StopCasting() { | 141 void CastConfigDelegateChromeos::StopCasting() { |
| 142 ExecuteJavaScript("backgroundSetup.stopMirroring('user-stop')"); |
| 143 |
| 144 // TODO(jdufault): Remove this after the beta/release versions of the |
| 145 // cast extension have been updated so that they properly export the |
| 146 // stopMirroring function. For now, we try to invoke all of the other |
| 147 // names that the function goes by. See crbug.com/489929. |
142 ExecuteJavaScript("backgroundSetup.stopCastMirroring('user-stop');"); | 148 ExecuteJavaScript("backgroundSetup.stopCastMirroring('user-stop');"); |
143 | |
144 // TODO(jdufault): Remove this after stopCastMirroring is properly exported. | |
145 // The current beta/release versions of the cast extension do not export | |
146 // stopCastMirroring, so we will also try to call the minified version. | |
147 // See crbug.com/489929. | |
148 ExecuteJavaScript("backgroundSetup.Qu('user-stop');"); | 149 ExecuteJavaScript("backgroundSetup.Qu('user-stop');"); |
149 } | 150 } |
150 | 151 |
151 void CastConfigDelegateChromeos::LaunchCastOptions() { | 152 void CastConfigDelegateChromeos::LaunchCastOptions() { |
152 chrome::NavigateParams params( | 153 chrome::NavigateParams params( |
153 ProfileManager::GetActiveUserProfile(), | 154 ProfileManager::GetActiveUserProfile(), |
154 FindCastExtension()->GetResourceURL("options.html"), | 155 FindCastExtension()->GetResourceURL("options.html"), |
155 ui::PAGE_TRANSITION_LINK); | 156 ui::PAGE_TRANSITION_LINK); |
156 params.disposition = NEW_FOREGROUND_TAB; | 157 params.disposition = NEW_FOREGROUND_TAB; |
157 params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 158 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
158 chrome::Navigate(¶ms); | 159 chrome::Navigate(¶ms); |
159 } | 160 } |
160 | 161 |
161 } // namespace chromeos | 162 } // namespace chromeos |
OLD | NEW |