Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 BLIMP_CLIENT_CORE_CONTEXT_ASSIGNMENT_FETCHER_H_ | |
| 6 #define BLIMP_CLIENT_CORE_CONTEXT_ASSIGNMENT_FETCHER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "blimp/client/core/session/assignment_source.h" | |
| 12 #include "blimp/client/core/session/identity_source.h" | |
| 13 | |
| 14 namespace blimp { | |
| 15 namespace client { | |
| 16 | |
| 17 class AssignmentFetcher { | |
|
David Trainor- moved to gerrit
2016/10/13 03:52:29
This might be better off in core/session
| |
| 18 public: | |
| 19 AssignmentFetcher( | |
| 20 base::Callback<void(AssignmentRequestResult, const Assignment&)> | |
| 21 assignment_receieved_callback, | |
|
David Trainor- moved to gerrit
2016/10/13 03:52:29
receieved -> received
| |
| 22 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | |
| 23 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner); | |
| 24 | |
| 25 ~AssignmentFetcher(); | |
| 26 | |
| 27 void Fetch(BlimpClientContextDelegate* delegate); | |
| 28 | |
| 29 IdentitySource* GetIdentitySource(); | |
| 30 | |
| 31 private: | |
| 32 // Called when an OAuth2 token is received. Will then ask the | |
| 33 // AssignmentSource for an Assignment with this token. | |
| 34 void OnAuthTokenReceived(const std::string& client_auth_token); | |
| 35 | |
| 36 // Create IdentitySource which provides user sign in states and OAuth2 token | |
| 37 // service. | |
| 38 void CreateIdentitySource(); | |
| 39 | |
| 40 // Returns the URL to use for connections to the assigner. Used to construct | |
| 41 // the AssignmentSource. | |
| 42 GURL GetAssignerURL(); | |
| 43 | |
| 44 base::Callback<void(AssignmentRequestResult, const Assignment&)> | |
| 45 assignment_received_callback_; | |
| 46 | |
| 47 // The task runner to use for IO operations. | |
| 48 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; | |
| 49 | |
| 50 // The task runner to use for file operations. | |
| 51 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; | |
| 52 | |
| 53 // The AssignmentSource is used when the user of AssignmentFetcher calls | |
| 54 // Fetch() to get a valid assignment and later connect to the engine. | |
| 55 std::unique_ptr<AssignmentSource> assignment_source_; | |
| 56 | |
| 57 // Provide OAuth2 token and propagate account sign in states change. | |
| 58 std::unique_ptr<IdentitySource> identity_source_; | |
| 59 | |
| 60 BlimpClientContextDelegate* delegate_ = nullptr; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(AssignmentFetcher); | |
| 63 }; | |
| 64 | |
| 65 } // namespace client | |
| 66 } // namespace blimp | |
| 67 | |
| 68 #endif // BLIMP_CLIENT_CORE_CONTEXT_ASSIGNMENT_FETCHER_H_ | |
| OLD | NEW |