Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/notifier_options_util.h" | 5 #include "jingle/notifier/base/notifier_options_util.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "jingle/notifier/base/const_communicator.h" | 8 #include "jingle/notifier/base/const_communicator.h" |
| 9 #include "jingle/notifier/base/notifier_options.h" | 9 #include "jingle/notifier/base/notifier_options.h" |
| 10 #include "talk/xmpp/constants.h" | 10 #include "talk/xmpp/constants.h" |
| 11 #include "talk/xmpp/jid.h" | 11 #include "talk/xmpp/jid.h" |
| 12 | 12 |
| 13 namespace notifier { | 13 namespace notifier { |
| 14 | 14 |
| 15 buzz::XmppClientSettings MakeXmppClientSettings( | 15 buzz::XmppClientSettings MakeXmppClientSettings( |
| 16 const NotifierOptions& notifier_options, | 16 const NotifierOptions& notifier_options, |
| 17 const std::string& email, const std::string& token) { | 17 const std::string& email, const std::string& token) { |
| 18 buzz::Jid jid = buzz::Jid(email); | 18 buzz::Jid jid = buzz::Jid(email); |
| 19 DCHECK(!jid.node().empty()); | 19 DCHECK(!jid.node().empty()); |
| 20 DCHECK(jid.IsValid()); | 20 DCHECK(jid.IsValid()); |
| 21 | 21 |
| 22 buzz::XmppClientSettings xmpp_client_settings; | 22 buzz::XmppClientSettings xmpp_client_settings; |
| 23 xmpp_client_settings.set_user(jid.node()); | 23 xmpp_client_settings.set_user(jid.node()); |
| 24 xmpp_client_settings.set_resource("chrome-sync"); | 24 xmpp_client_settings.set_resource("chrome-sync"); |
| 25 xmpp_client_settings.set_host(jid.domain()); | 25 xmpp_client_settings.set_host(jid.domain()); |
| 26 xmpp_client_settings.set_use_tls(buzz::TLS_ENABLED); | 26 xmpp_client_settings.set_use_tls(buzz::TLS_ENABLED); |
| 27 xmpp_client_settings.set_auth_token(buzz::AUTH_MECHANISM_GOOGLE_TOKEN, | 27 xmpp_client_settings.set_auth_token(notifier_options.auth_mechanism, |
| 28 notifier_options.invalidate_xmpp_login ? | 28 notifier_options.invalidate_xmpp_login ? |
| 29 token + "bogus" : token); | 29 token + "bogus" : token); |
| 30 xmpp_client_settings.set_token_service("chromiumsync"); | 30 if (notifier_options.auth_mechanism == buzz::AUTH_MECHANISM_OAUTH2) |
|
tim (not reviewing)
2013/05/23 19:03:42
We should use a constant (this one or otherwise) f
pavely
2013/05/30 07:42:12
I changed sync_backend_host.cc to use AUTH_MECHANI
| |
| 31 xmpp_client_settings.set_token_service("oauth2"); | |
| 32 else | |
| 33 xmpp_client_settings.set_token_service("chromiumsync"); | |
| 31 if (notifier_options.allow_insecure_connection) { | 34 if (notifier_options.allow_insecure_connection) { |
| 32 xmpp_client_settings.set_allow_plain(true); | 35 xmpp_client_settings.set_allow_plain(true); |
| 33 xmpp_client_settings.set_use_tls(buzz::TLS_DISABLED); | 36 xmpp_client_settings.set_use_tls(buzz::TLS_DISABLED); |
| 34 } | 37 } |
| 35 return xmpp_client_settings; | 38 return xmpp_client_settings; |
| 36 } | 39 } |
| 37 | 40 |
| 38 ServerList GetServerList( | 41 ServerList GetServerList( |
| 39 const NotifierOptions& notifier_options) { | 42 const NotifierOptions& notifier_options) { |
| 40 ServerList servers; | 43 ServerList servers; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 54 servers.push_back( | 57 servers.push_back( |
| 55 ServerInformation( | 58 ServerInformation( |
| 56 net::HostPortPair("talkx.l.google.com", | 59 net::HostPortPair("talkx.l.google.com", |
| 57 notifier::kDefaultXmppPort), | 60 notifier::kDefaultXmppPort), |
| 58 SUPPORTS_SSLTCP)); | 61 SUPPORTS_SSLTCP)); |
| 59 } | 62 } |
| 60 return servers; | 63 return servers; |
| 61 } | 64 } |
| 62 | 65 |
| 63 } // namespace notifier | 66 } // namespace notifier |
| OLD | NEW |