OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "jingle/notifier/base/gaia_token_pre_xmpp_auth.h" | 5 #include "jingle/notifier/base/gaia_token_pre_xmpp_auth.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 std::string GaiaTokenPreXmppAuth::GetAuthToken() const { | 94 std::string GaiaTokenPreXmppAuth::GetAuthToken() const { |
95 return token_; | 95 return token_; |
96 } | 96 } |
97 | 97 |
98 std::string GaiaTokenPreXmppAuth::GetAuthMechanism() const { | 98 std::string GaiaTokenPreXmppAuth::GetAuthMechanism() const { |
99 return auth_mechanism_; | 99 return auth_mechanism_; |
100 } | 100 } |
101 | 101 |
102 std::string GaiaTokenPreXmppAuth::ChooseBestSaslMechanism( | 102 std::string GaiaTokenPreXmppAuth::ChooseBestSaslMechanism( |
103 const std::vector<std::string> & mechanisms, bool encrypted) { | 103 const std::vector<std::string> & mechanisms, bool encrypted) { |
104 return (std::find(mechanisms.begin(), | 104 return (std::find(mechanisms.begin(), mechanisms.end(), auth_mechanism_) != |
105 mechanisms.end(), auth_mechanism_) != | 105 mechanisms.end()) |
106 mechanisms.end()) ? auth_mechanism_ : ""; | 106 ? auth_mechanism_ |
| 107 : std::string(); |
107 } | 108 } |
108 | 109 |
109 buzz::SaslMechanism* GaiaTokenPreXmppAuth::CreateSaslMechanism( | 110 buzz::SaslMechanism* GaiaTokenPreXmppAuth::CreateSaslMechanism( |
110 const std::string& mechanism) { | 111 const std::string& mechanism) { |
111 if (mechanism == auth_mechanism_) | 112 if (mechanism == auth_mechanism_) |
112 return new GaiaCookieMechanism( | 113 return new GaiaCookieMechanism( |
113 mechanism, username_, token_, token_service_); | 114 mechanism, username_, token_, token_service_); |
114 return NULL; | 115 return NULL; |
115 } | 116 } |
116 | 117 |
117 } // namespace notifier | 118 } // namespace notifier |
OLD | NEW |