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 { | |
| 18 public: | |
| 19 using AuthErrorCallback = base::Callback<void(const GoogleServiceAuthError&)>; | |
| 20 using AssignmentResultCallback = | |
| 21 base::Callback<void(AssignmentRequestResult, const Assignment&)>; | |
| 22 | |
| 23 AssignmentFetcher( | |
| 24 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | |
| 25 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, | |
| 26 std::unique_ptr<IdentityProvider> identity_provider, | |
| 27 GURL assigner_url, | |
| 28 const AssignmentResultCallback assignment_received_callback, | |
|
David Trainor- moved to gerrit
2016/10/25 03:14:27
const &
CJ
2016/10/25 20:38:01
Done.
| |
| 29 const AuthErrorCallback error_callback); | |
|
David Trainor- moved to gerrit
2016/10/25 03:14:27
const &
CJ
2016/10/25 20:38:01
Done.
| |
| 30 | |
| 31 ~AssignmentFetcher(); | |
| 32 | |
| 33 void Fetch(); | |
| 34 | |
| 35 IdentitySource* GetIdentitySource(); | |
| 36 | |
| 37 private: | |
| 38 // Called when an OAuth2 token is received. Will then ask the | |
| 39 // AssignmentSource for an Assignment with this token. | |
| 40 void OnAuthTokenReceived(const std::string& client_auth_token); | |
| 41 | |
| 42 // Provide OAuth2 token and propagate account sign in states change. | |
| 43 std::unique_ptr<IdentitySource> identity_source_; | |
| 44 | |
| 45 // Returns the URL to use for connections to the assigner. Used to construct | |
| 46 // the AssignmentSource. | |
|
David Trainor- moved to gerrit
2016/10/25 03:14:27
move comment over assigner_url_
CJ
2016/10/25 20:38:01
Done.
| |
| 47 AssignmentResultCallback assignment_received_callback_; | |
| 48 | |
| 49 GURL assigner_url_; | |
| 50 | |
| 51 // The AssignmentSource is used when the user of AssignmentFetcher calls | |
| 52 // Fetch() to get a valid assignment and later connect to the engine. | |
| 53 std::unique_ptr<AssignmentSource> assignment_source_; | |
| 54 | |
| 55 // The task runner to use for IO operations. | |
| 56 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; | |
| 57 | |
| 58 // The task runner to use for file operations. | |
| 59 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(AssignmentFetcher); | |
| 62 }; | |
| 63 | |
| 64 } // namespace client | |
| 65 } // namespace blimp | |
| 66 | |
| 67 #endif // BLIMP_CLIENT_CORE_CONTEXT_ASSIGNMENT_FETCHER_H_ | |
| OLD | NEW |