Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / jingle / notifier / communicator / login_settings.h
blob04ab92d4f4d25632bd7bc3622a61585aa2757f2f
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
3 // found in the LICENSE file.
5 #ifndef JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_SETTINGS_H_
6 #define JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_SETTINGS_H_
7 #include <string>
9 #include "base/memory/ref_counted.h"
10 #include "base/time/time.h"
11 #include "jingle/notifier/base/server_information.h"
12 #include "net/url_request/url_request_context_getter.h"
13 #include "talk/xmpp/xmppclientsettings.h"
15 namespace notifier {
17 class LoginSettings {
18 public:
19 LoginSettings(const buzz::XmppClientSettings& user_settings,
20 const scoped_refptr<net::URLRequestContextGetter>&
21 request_context_getter,
22 const ServerList& default_servers,
23 bool try_ssltcp_first,
24 const std::string& auth_mechanism);
26 ~LoginSettings();
28 // Copy constructor and assignment operator welcome.
30 const buzz::XmppClientSettings& user_settings() const {
31 return user_settings_;
34 void set_user_settings(const buzz::XmppClientSettings& user_settings);
36 scoped_refptr<net::URLRequestContextGetter> request_context_getter() const {
37 return request_context_getter_;
40 bool try_ssltcp_first() const {
41 return try_ssltcp_first_;
44 const std::string& auth_mechanism() const {
45 return auth_mechanism_;
48 ServerList GetServers() const;
50 // The redirect server will eventually expire.
51 void SetRedirectServer(const ServerInformation& redirect_server);
53 ServerList GetServersForTimeForTest(base::Time now) const;
55 base::Time GetRedirectExpirationForTest() const;
57 private:
58 ServerList GetServersForTime(base::Time now) const;
60 buzz::XmppClientSettings user_settings_;
61 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
62 ServerList default_servers_;
63 bool try_ssltcp_first_;
64 std::string auth_mechanism_;
66 // Used to handle redirects
67 ServerInformation redirect_server_;
68 base::Time redirect_expiration_;
72 } // namespace notifier
74 #endif // JINGLE_NOTIFIER_COMMUNICATOR_LOGIN_SETTINGS_H_