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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 | 120 |
121 CastConfigDelegateChromeos::~CastConfigDelegateChromeos() { | 121 CastConfigDelegateChromeos::~CastConfigDelegateChromeos() { |
122 } | 122 } |
123 | 123 |
124 bool CastConfigDelegateChromeos::HasCastExtension() const { | 124 bool CastConfigDelegateChromeos::HasCastExtension() const { |
125 return FindCastExtension() != nullptr; | 125 return FindCastExtension() != nullptr; |
126 } | 126 } |
127 | 127 |
128 void CastConfigDelegateChromeos::GetReceiversAndActivities( | 128 void CastConfigDelegateChromeos::GetReceiversAndActivities( |
129 const ReceiversAndActivitesCallback& callback) { | 129 const ReceiversAndActivitesCallback& callback) { |
130 // The methods in backgroundSetup are renamed during minification, so we have | |
131 // to bind the exported global API methods to backgroundSetup using call(). | |
130 ExecuteJavaScriptWithCallback( | 132 ExecuteJavaScriptWithCallback( |
131 "backgroundSetup.getMirrorCapableReceiversAndActivities();", | 133 "getMirrorCapableReceiversAndActivities.call(backgroundSetup);", |
132 base::Bind(&GetReceiversAndActivitiesCallback, callback)); | 134 base::Bind(&GetReceiversAndActivitiesCallback, callback)); |
133 } | 135 } |
134 | 136 |
135 void CastConfigDelegateChromeos::CastToReceiver( | 137 void CastConfigDelegateChromeos::CastToReceiver( |
136 const std::string& receiver_id) { | 138 const std::string& receiver_id) { |
137 ExecuteJavaScript("backgroundSetup.launchDesktopMirroring('" + receiver_id + | 139 // The methods in backgroundSetup are renamed during minification, so we have |
138 "');"); | 140 // to bind the exported global API methods to backgroundSetup using call(). |
141 ExecuteJavaScript("launchDesktopMirroring.call(backgroundSetup, '" + | |
142 receiver_id + "');"); | |
139 } | 143 } |
140 | 144 |
141 void CastConfigDelegateChromeos::StopCasting() { | 145 void CastConfigDelegateChromeos::StopCasting() { |
142 ExecuteJavaScript("backgroundSetup.stopMirroring('user-stop')"); | 146 // The methods in backgroundSetup are renamed during minification, so we have |
147 // to bind the exported global API methods to backgroundSetup using call(). | |
148 ExecuteJavaScript("stopMirroring.call(backgroundSetup, 'user-stop');"); | |
143 | 149 |
144 // TODO(jdufault): Remove this after the beta/release versions of the | 150 // TODO(jdufault): Remove this after the beta/release versions of the |
145 // cast extension have been updated so that they properly export the | 151 // cast extension have been updated so that they properly export the |
146 // stopMirroring function. For now, we try to invoke all of the other | 152 // stopMirroring function. For now, we try to invoke all of the other |
147 // names that the function goes by. See crbug.com/489929. | 153 // names that the function goes by. See crbug.com/489929. |
148 ExecuteJavaScript("backgroundSetup.stopCastMirroring('user-stop');"); | |
149 ExecuteJavaScript("backgroundSetup.Qu('user-stop');"); | 154 ExecuteJavaScript("backgroundSetup.Qu('user-stop');"); |
achuithb
2015/06/08 19:09:42
Do you need this? This is a work-around for minifi
achuithb
2015/06/08 19:10:38
Or was this necessary because the symbol was not y
jdufault
2015/06/08 19:16:19
Right, the symbol was not exported yet. So we work
achuithb
2015/06/08 19:18:47
Could we file a bug so we can track this? And refe
jdufault
2015/06/08 19:29:49
Yep, see the comment above. The bug is at crbug.co
achuithb
2015/06/08 19:31:17
Ah, oops. you're right.
| |
150 } | 155 } |
151 | 156 |
152 void CastConfigDelegateChromeos::LaunchCastOptions() { | 157 void CastConfigDelegateChromeos::LaunchCastOptions() { |
153 chrome::NavigateParams params( | 158 chrome::NavigateParams params( |
154 ProfileManager::GetActiveUserProfile(), | 159 ProfileManager::GetActiveUserProfile(), |
155 FindCastExtension()->GetResourceURL("options.html"), | 160 FindCastExtension()->GetResourceURL("options.html"), |
156 ui::PAGE_TRANSITION_LINK); | 161 ui::PAGE_TRANSITION_LINK); |
157 params.disposition = NEW_FOREGROUND_TAB; | 162 params.disposition = NEW_FOREGROUND_TAB; |
158 params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 163 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
159 chrome::Navigate(¶ms); | 164 chrome::Navigate(¶ms); |
160 } | 165 } |
161 | 166 |
162 } // namespace chromeos | 167 } // namespace chromeos |
OLD | NEW |