OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ | 5 #ifndef BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ |
6 #define BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ | 6 #define BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 public: | 36 public: |
37 // The |io_thread_task_runner| must be the task runner to use for IO | 37 // The |io_thread_task_runner| must be the task runner to use for IO |
38 // operations. | 38 // operations. |
39 // The |file_thread_task_runner| must be the task runner to use for file | 39 // The |file_thread_task_runner| must be the task runner to use for file |
40 // operations. | 40 // operations. |
41 BlimpClientContextImpl( | 41 BlimpClientContextImpl( |
42 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | 42 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, |
43 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner); | 43 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner); |
44 ~BlimpClientContextImpl() override; | 44 ~BlimpClientContextImpl() override; |
45 | 45 |
| 46 IdentitySource* GetIdentitySource(); |
| 47 |
46 // BlimpClientContext implementation. | 48 // BlimpClientContext implementation. |
47 void SetDelegate(BlimpClientContextDelegate* delegate) override; | 49 void SetDelegate(BlimpClientContextDelegate* delegate) override; |
48 std::unique_ptr<BlimpContents> CreateBlimpContents() override; | 50 std::unique_ptr<BlimpContents> CreateBlimpContents() override; |
49 void Connect() override; | 51 void Connect() override; |
50 | 52 |
51 // NetworkEventObserver implementation. | 53 // NetworkEventObserver implementation. |
52 void OnConnected() override; | 54 void OnConnected() override; |
53 void OnDisconnected(int result) override; | 55 void OnDisconnected(int result) override; |
54 | 56 |
55 TabControlFeature* GetTabControlFeature() const; | 57 TabControlFeature* GetTabControlFeature() const; |
56 | 58 |
57 protected: | 59 protected: |
58 // Returns the URL to use for connections to the assigner. Used to construct | 60 // Returns the URL to use for connections to the assigner. Used to construct |
59 // the AssignmentSource. | 61 // the AssignmentSource. |
60 virtual GURL GetAssignerURL(); | 62 virtual GURL GetAssignerURL(); |
61 | 63 |
| 64 // Create IdentitySource which provides user sign in states and OAuth2 token |
| 65 // service. |
| 66 void CreateIdentitySource(); |
| 67 |
| 68 // Provide OAuth2 token and propagate account sign in states change. |
| 69 std::unique_ptr<IdentitySource> identity_source_; |
| 70 |
62 private: | 71 private: |
63 // Connect to assignment source with OAuth2 token to get an assignment. | 72 // Connect to assignment source with OAuth2 token to get an assignment. |
64 virtual void ConnectToAssignmentSource(const std::string& client_auth_token); | 73 virtual void ConnectToAssignmentSource(const std::string& client_auth_token); |
65 | 74 |
66 // The AssignmentCallback for when an assignment is ready. This will trigger | 75 // The AssignmentCallback for when an assignment is ready. This will trigger |
67 // a connection to the engine. | 76 // a connection to the engine. |
68 virtual void ConnectWithAssignment(AssignmentRequestResult result, | 77 virtual void ConnectWithAssignment(AssignmentRequestResult result, |
69 const Assignment& assignment); | 78 const Assignment& assignment); |
70 | 79 |
71 void RegisterFeatures(); | 80 void RegisterFeatures(); |
(...skipping 17 matching lines...) Expand all Loading... |
89 std::unique_ptr<TabControlFeature> tab_control_feature_; | 98 std::unique_ptr<TabControlFeature> tab_control_feature_; |
90 | 99 |
91 std::unique_ptr<BlimpContentsManager> blimp_contents_manager_; | 100 std::unique_ptr<BlimpContentsManager> blimp_contents_manager_; |
92 | 101 |
93 // Container struct for network components. | 102 // Container struct for network components. |
94 // Must be deleted on the IO thread. | 103 // Must be deleted on the IO thread. |
95 std::unique_ptr<ClientNetworkComponents> net_components_; | 104 std::unique_ptr<ClientNetworkComponents> net_components_; |
96 | 105 |
97 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; | 106 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; |
98 | 107 |
99 // Provide OAuth2 token and propagate account sign in states change. | |
100 std::unique_ptr<IdentitySource> identity_source_; | |
101 | |
102 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; | 108 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; |
103 | 109 |
104 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); | 110 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); |
105 }; | 111 }; |
106 | 112 |
107 } // namespace client | 113 } // namespace client |
108 } // namespace blimp | 114 } // namespace blimp |
109 | 115 |
110 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ | 116 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ |
OLD | NEW |