OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_AUTH_TASK_H_ |
| 6 #define CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_AUTH_TASK_H_ |
| 7 |
| 8 #include <string> |
| 9 #include "talk/base/scoped_ptr.h" |
| 10 #include "talk/base/sigslot.h" |
| 11 #include "talk/base/task.h" |
| 12 |
| 13 namespace buzz { |
| 14 class GaiaAuth; |
| 15 } |
| 16 |
| 17 namespace notifier { |
| 18 class Login; |
| 19 |
| 20 // Create an authenticated talk url from an unauthenticated url |
| 21 class AuthTask : public talk_base::Task, public sigslot::has_slots<> { |
| 22 public: |
| 23 AuthTask(talk_base::Task* parent, Login* login, const char* url); |
| 24 |
| 25 // An abort method which doesn't take any parameters. |
| 26 // (talk_base::Task::Abort() has a default parameter.) |
| 27 // |
| 28 // The primary purpose of this method is to allow a |
| 29 // signal to be hooked up to abort this task. |
| 30 void Abort() { |
| 31 talk_base::Task::Abort(); |
| 32 } |
| 33 |
| 34 void set_service(const char* service) { |
| 35 service_ = service; |
| 36 } |
| 37 |
| 38 void set_use_gaia_redirect(bool use_gaia_redirect) { |
| 39 use_gaia_redirect_ = use_gaia_redirect; |
| 40 } |
| 41 |
| 42 void set_redir_auth_prefix(const char* redir_auth_prefix) { |
| 43 redir_auth_prefix_ = redir_auth_prefix; |
| 44 } |
| 45 |
| 46 void set_redir_continue(const char* redir_continue) { |
| 47 redir_continue_ = redir_continue; |
| 48 } |
| 49 |
| 50 sigslot::signal1<const std::string&> SignalAuthDone; |
| 51 sigslot::signal1<bool> SignalAuthError; |
| 52 |
| 53 protected: |
| 54 virtual int ProcessStart(); |
| 55 virtual int ProcessResponse(); |
| 56 |
| 57 private: |
| 58 void OnAuthDone(); |
| 59 |
| 60 scoped_ptr<buzz::GaiaAuth> auth_; |
| 61 Login* login_; |
| 62 std::string service_; |
| 63 std::string url_; |
| 64 |
| 65 // the following members are used for cases where we don't want to |
| 66 // redirect through gaia, but rather via the end-site's mechanism |
| 67 // (We need this for orkut) |
| 68 bool use_gaia_redirect_; |
| 69 std::string redir_auth_prefix_; |
| 70 std::string redir_continue_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(AuthTask); |
| 73 }; |
| 74 |
| 75 } // namespace notifier |
| 76 |
| 77 #endif // CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_AUTH_TASK_H_ |
OLD | NEW |