OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "remoting/host/it2me/it2me_native_messaging_host.h" | 5 #include "remoting/host/it2me/it2me_native_messaging_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (!message.GetString("authServiceWithToken", &auth_service_with_token)) { | 161 if (!message.GetString("authServiceWithToken", &auth_service_with_token)) { |
162 SendErrorAndExit(response.Pass(), | 162 SendErrorAndExit(response.Pass(), |
163 "'authServiceWithToken' not found in request."); | 163 "'authServiceWithToken' not found in request."); |
164 return; | 164 return; |
165 } | 165 } |
166 | 166 |
167 // For backward compatibility the webapp still passes OAuth service as part of | 167 // For backward compatibility the webapp still passes OAuth service as part of |
168 // the authServiceWithToken field. But auth service part is always expected to | 168 // the authServiceWithToken field. But auth service part is always expected to |
169 // be set to oauth2. | 169 // be set to oauth2. |
170 const char kOAuth2ServicePrefix[] = "oauth2:"; | 170 const char kOAuth2ServicePrefix[] = "oauth2:"; |
171 if (!base::StartsWithASCII(auth_service_with_token, kOAuth2ServicePrefix, | 171 if (!base::StartsWith(auth_service_with_token, kOAuth2ServicePrefix, |
172 true)) { | 172 base::CompareCase::SENSITIVE)) { |
173 SendErrorAndExit(response.Pass(), "Invalid 'authServiceWithToken': " + | 173 SendErrorAndExit(response.Pass(), "Invalid 'authServiceWithToken': " + |
174 auth_service_with_token); | 174 auth_service_with_token); |
175 return; | 175 return; |
176 } | 176 } |
177 | 177 |
178 xmpp_config.auth_token = | 178 xmpp_config.auth_token = |
179 auth_service_with_token.substr(strlen(kOAuth2ServicePrefix)); | 179 auth_service_with_token.substr(strlen(kOAuth2ServicePrefix)); |
180 | 180 |
181 #if !defined(NDEBUG) | 181 #if !defined(NDEBUG) |
182 std::string address; | 182 std::string address; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 return host_context_->ui_task_runner(); | 319 return host_context_->ui_task_runner(); |
320 } | 320 } |
321 | 321 |
322 /* static */ | 322 /* static */ |
323 std::string It2MeNativeMessagingHost::HostStateToString( | 323 std::string It2MeNativeMessagingHost::HostStateToString( |
324 It2MeHostState host_state) { | 324 It2MeHostState host_state) { |
325 return ValueToName(kIt2MeHostStates, host_state); | 325 return ValueToName(kIt2MeHostStates, host_state); |
326 } | 326 } |
327 | 327 |
328 } // namespace remoting | 328 } // namespace remoting |
OLD | NEW |