| 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 (!StartsWithASCII(auth_service_with_token, kOAuth2ServicePrefix, true)) { | 171 if (!base::StartsWithASCII(auth_service_with_token, kOAuth2ServicePrefix, |
| 172 true)) { |
| 172 SendErrorAndExit(response.Pass(), "Invalid 'authServiceWithToken': " + | 173 SendErrorAndExit(response.Pass(), "Invalid 'authServiceWithToken': " + |
| 173 auth_service_with_token); | 174 auth_service_with_token); |
| 174 return; | 175 return; |
| 175 } | 176 } |
| 176 | 177 |
| 177 xmpp_config.auth_token = | 178 xmpp_config.auth_token = |
| 178 auth_service_with_token.substr(strlen(kOAuth2ServicePrefix)); | 179 auth_service_with_token.substr(strlen(kOAuth2ServicePrefix)); |
| 179 | 180 |
| 180 #if !defined(NDEBUG) | 181 #if !defined(NDEBUG) |
| 181 std::string address; | 182 std::string address; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 } | 310 } |
| 310 | 311 |
| 311 /* static */ | 312 /* static */ |
| 312 std::string It2MeNativeMessagingHost::HostStateToString( | 313 std::string It2MeNativeMessagingHost::HostStateToString( |
| 313 It2MeHostState host_state) { | 314 It2MeHostState host_state) { |
| 314 return ValueToName(kIt2MeHostStates, host_state); | 315 return ValueToName(kIt2MeHostStates, host_state); |
| 315 } | 316 } |
| 316 | 317 |
| 317 } // namespace remoting | 318 } // namespace remoting |
| 318 | 319 |
| OLD | NEW |