| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/base/service_urls.h" | 5 #include "remoting/base/service_urls.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 // Configurable service data. | 10 // Configurable service data. |
| 11 const char kDirectoryBaseUrl[] = "https://www.googleapis.com/chromoting/v1"; | 11 const char kDirectoryBaseUrl[] = "https://www.googleapis.com/chromoting/v1"; |
| 12 const char kXmppServerAddress[] = "talk.google.com:443"; | 12 const char kXmppServerAddress[] = "talk.google.com:443"; |
| 13 const char kXmppServerAddressForMe2MeHost[] = "talk.google.com:5222"; |
| 13 const bool kXmppServerUseTls = true; | 14 const bool kXmppServerUseTls = true; |
| 14 const char kDirectoryBotJid[] = "remoting@bot.talk.google.com"; | 15 const char kDirectoryBotJid[] = "remoting@bot.talk.google.com"; |
| 15 | 16 |
| 16 // Command line switches. | 17 // Command line switches. |
| 17 #if !defined(NDEBUG) | 18 #if !defined(NDEBUG) |
| 18 const char kDirectoryBaseUrlSwitch[] = "directory-base-url"; | 19 const char kDirectoryBaseUrlSwitch[] = "directory-base-url"; |
| 19 const char kXmppServerAddressSwitch[] = "xmpp-server-address"; | 20 const char kXmppServerAddressSwitch[] = "xmpp-server-address"; |
| 20 const char kXmppServerDisableTlsSwitch[] = "disable-xmpp-server-tls"; | 21 const char kXmppServerDisableTlsSwitch[] = "disable-xmpp-server-tls"; |
| 21 const char kDirectoryBotJidSwitch[] = "directory-bot-jid"; | 22 const char kDirectoryBotJidSwitch[] = "directory-bot-jid"; |
| 22 #endif // !defined(NDEBUG) | 23 #endif // !defined(NDEBUG) |
| 23 | 24 |
| 24 // Non-configurable service paths. | 25 // Non-configurable service paths. |
| 25 const char kDirectoryHostsSuffix[] = "/@me/hosts/"; | 26 const char kDirectoryHostsSuffix[] = "/@me/hosts/"; |
| 26 | 27 |
| 27 namespace remoting { | 28 namespace remoting { |
| 28 | 29 |
| 29 ServiceUrls::ServiceUrls() | 30 ServiceUrls::ServiceUrls() |
| 30 : directory_base_url_(kDirectoryBaseUrl), | 31 : directory_base_url_(kDirectoryBaseUrl), |
| 31 xmpp_server_address_(kXmppServerAddress), | 32 xmpp_server_address_(kXmppServerAddress), |
| 32 xmpp_server_use_tls_(kXmppServerUseTls), | 33 xmpp_server_address_for_me2me_host_(kXmppServerAddressForMe2MeHost), |
| 33 directory_bot_jid_(kDirectoryBotJid) { | 34 xmpp_server_use_tls_(kXmppServerUseTls), |
| 35 directory_bot_jid_(kDirectoryBotJid) { |
| 34 #if !defined(NDEBUG) | 36 #if !defined(NDEBUG) |
| 35 // Allow debug builds to override urls via command line. | 37 // Allow debug builds to override urls via command line. |
| 36 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 38 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 37 CHECK(command_line); | 39 CHECK(command_line); |
| 38 if (command_line->HasSwitch(kDirectoryBaseUrlSwitch)) { | 40 if (command_line->HasSwitch(kDirectoryBaseUrlSwitch)) { |
| 39 directory_base_url_ = command_line->GetSwitchValueASCII( | 41 directory_base_url_ = command_line->GetSwitchValueASCII( |
| 40 kDirectoryBaseUrlSwitch); | 42 kDirectoryBaseUrlSwitch); |
| 41 } | 43 } |
| 42 if (command_line->HasSwitch(kXmppServerAddressSwitch)) { | 44 if (command_line->HasSwitch(kXmppServerAddressSwitch)) { |
| 43 xmpp_server_address_ = command_line->GetSwitchValueASCII( | 45 xmpp_server_address_ = command_line->GetSwitchValueASCII( |
| 44 kXmppServerAddressSwitch); | 46 kXmppServerAddressSwitch); |
| 47 xmpp_server_address_for_me2me_host_ = xmpp_server_address_; |
| 45 } | 48 } |
| 46 if (command_line->HasSwitch(kXmppServerDisableTlsSwitch)) { | 49 if (command_line->HasSwitch(kXmppServerDisableTlsSwitch)) { |
| 47 xmpp_server_use_tls_ = false; | 50 xmpp_server_use_tls_ = false; |
| 48 } | 51 } |
| 49 if (command_line->HasSwitch(kDirectoryBotJidSwitch)) { | 52 if (command_line->HasSwitch(kDirectoryBotJidSwitch)) { |
| 50 directory_bot_jid_ = command_line->GetSwitchValueASCII( | 53 directory_bot_jid_ = command_line->GetSwitchValueASCII( |
| 51 kDirectoryBotJidSwitch); | 54 kDirectoryBotJidSwitch); |
| 52 } | 55 } |
| 53 #endif // !defined(NDEBUG) | 56 #endif // !defined(NDEBUG) |
| 54 | 57 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 67 } | 70 } |
| 68 | 71 |
| 69 const std::string& ServiceUrls::directory_hosts_url() const { | 72 const std::string& ServiceUrls::directory_hosts_url() const { |
| 70 return directory_hosts_url_; | 73 return directory_hosts_url_; |
| 71 } | 74 } |
| 72 | 75 |
| 73 const std::string& ServiceUrls::xmpp_server_address() const { | 76 const std::string& ServiceUrls::xmpp_server_address() const { |
| 74 return xmpp_server_address_; | 77 return xmpp_server_address_; |
| 75 } | 78 } |
| 76 | 79 |
| 80 const std::string& ServiceUrls::xmpp_server_address_for_me2me_host() const { |
| 81 return xmpp_server_address_for_me2me_host_; |
| 82 } |
| 83 |
| 77 bool ServiceUrls::xmpp_server_use_tls() const { | 84 bool ServiceUrls::xmpp_server_use_tls() const { |
| 78 return xmpp_server_use_tls_; | 85 return xmpp_server_use_tls_; |
| 79 } | 86 } |
| 80 | 87 |
| 81 const std::string& ServiceUrls::directory_bot_jid() const { | 88 const std::string& ServiceUrls::directory_bot_jid() const { |
| 82 return directory_bot_jid_; | 89 return directory_bot_jid_; |
| 83 } | 90 } |
| 84 | 91 |
| 85 } // namespace remoting | 92 } // namespace remoting |
| OLD | NEW |