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_TALK_AUTH_TASK_H_ |
| 6 #define CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_TALK_AUTH_TASK_H_ |
| 7 |
| 8 #include "talk/base/scoped_ptr.h" |
| 9 #include "talk/base/sigslot.h" |
| 10 #include "talk/base/task.h" |
| 11 |
| 12 namespace buzz { |
| 13 class GaiaAuth; |
| 14 } |
| 15 |
| 16 namespace notifier { |
| 17 class Login; |
| 18 |
| 19 // Create an authenticated talk url from an unauthenticated url |
| 20 class TalkAuthTask : public talk_base::Task, public sigslot::has_slots<> { |
| 21 public: |
| 22 TalkAuthTask(talk_base::Task* parent, |
| 23 Login* login, |
| 24 const char* url); |
| 25 |
| 26 // An abort method which doesn't take any parameters. |
| 27 // (talk_base::Task::Abort() has a default parameter.) |
| 28 // |
| 29 // The primary purpose of this method is to allow a |
| 30 // signal to be hooked up to abort this task. |
| 31 void Abort() { |
| 32 talk_base::Task::Abort(); |
| 33 } |
| 34 |
| 35 const std::string& url() { |
| 36 return url_; |
| 37 } |
| 38 |
| 39 std::string GetAuthenticatedUrl(const char* talk_base_url) const; |
| 40 std::string GetSID() const; |
| 41 |
| 42 sigslot::signal1<const TalkAuthTask&> SignalAuthDone; |
| 43 |
| 44 bool HadError() const; |
| 45 |
| 46 // TODO(sync): add captcha support |
| 47 |
| 48 protected: |
| 49 virtual int ProcessStart(); |
| 50 virtual int ProcessResponse(); |
| 51 |
| 52 private: |
| 53 void OnAuthDone(); |
| 54 |
| 55 scoped_ptr<buzz::GaiaAuth> auth_; |
| 56 Login* login_; |
| 57 std::string url_; |
| 58 DISALLOW_COPY_AND_ASSIGN(TalkAuthTask); |
| 59 }; |
| 60 } // namespace notifier |
| 61 |
| 62 #endif // CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_TALK_AUTH_TASK_H_ |
OLD | NEW |