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_PUBLIC_BLIMP_CLIENT_CONTEXT_H_ | 5 #ifndef BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_H_ |
6 #define BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_H_ | 6 #define BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "blimp/client/public/blimp_client_context_delegate.h" | 13 #include "blimp/client/public/blimp_client_context_delegate.h" |
14 #include "blimp/client/public/contents/blimp_contents.h" | 14 #include "blimp/client/public/contents/blimp_contents.h" |
15 #include "components/keyed_service/core/keyed_service.h" | 15 #include "components/keyed_service/core/keyed_service.h" |
16 | 16 |
17 #if defined(OS_ANDROID) | 17 #if defined(OS_ANDROID) |
18 #include "base/android/jni_android.h" | 18 #include "base/android/jni_android.h" |
19 #endif // defined(OS_ANDROID) | 19 #endif // defined(OS_ANDROID) |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class SupportsUserData; | 22 class SupportsUserData; |
23 } | 23 } |
24 | 24 |
25 namespace blimp { | 25 namespace blimp { |
26 namespace client { | 26 namespace client { |
| 27 class CompositorDependencies; |
27 | 28 |
28 // BlimpClientContext is the core class for the Blimp client. It provides hooks | 29 // BlimpClientContext is the core class for the Blimp client. It provides hooks |
29 // for creating BlimpContents and other features that are per | 30 // for creating BlimpContents and other features that are per |
30 // BrowserContext/Profile. | 31 // BrowserContext/Profile. |
31 class BlimpClientContext : public KeyedService { | 32 class BlimpClientContext : public KeyedService { |
32 public: | 33 public: |
33 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
34 // Returns a Java object of the type BlimpClientContext for the given | 35 // Returns a Java object of the type BlimpClientContext for the given |
35 // BlimpClientContext. | 36 // BlimpClientContext. |
36 static base::android::ScopedJavaLocalRef<jobject> GetJavaObject( | 37 static base::android::ScopedJavaLocalRef<jobject> GetJavaObject( |
37 BlimpClientContext* blimp_client_context); | 38 BlimpClientContext* blimp_client_context); |
38 #endif // defined(OS_ANDROID) | 39 #endif // defined(OS_ANDROID) |
39 | 40 |
40 // Creates a BlimpClientContext. The implementation of this function | 41 // Creates a BlimpClientContext. The implementation of this function |
41 // depends on whether the core or dummy implementation of Blimp has been | 42 // depends on whether the core or dummy implementation of Blimp has been |
42 // linked in. | 43 // linked in. |
43 // The |io_thread_task_runner| must be the task runner to use for IO | 44 // The |io_thread_task_runner| must be the task runner to use for IO |
44 // operations. | 45 // operations. |
45 // The |file_thread_task_runner| must be the task runner to use for file | 46 // The |file_thread_task_runner| must be the task runner to use for file |
46 // operations. | 47 // operations. |
47 static BlimpClientContext* Create( | 48 static BlimpClientContext* Create( |
48 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | 49 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, |
49 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner); | 50 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, |
| 51 std::unique_ptr<CompositorDependencies> compositor_dependencies); |
50 | 52 |
51 // The delegate provides all the required functionality from the embedder. | 53 // The delegate provides all the required functionality from the embedder. |
52 virtual void SetDelegate(BlimpClientContextDelegate* delegate) = 0; | 54 virtual void SetDelegate(BlimpClientContextDelegate* delegate) = 0; |
53 | 55 |
54 // Creates a new BlimpContents. | 56 // Creates a new BlimpContents. |
55 virtual std::unique_ptr<BlimpContents> CreateBlimpContents() = 0; | 57 virtual std::unique_ptr<BlimpContents> CreateBlimpContents() = 0; |
56 | 58 |
57 // Start authentication flow and connection to engine. | 59 // Start authentication flow and connection to engine. |
58 virtual void Connect() = 0; | 60 virtual void Connect() = 0; |
59 | 61 |
60 protected: | 62 protected: |
61 BlimpClientContext() = default; | 63 BlimpClientContext() = default; |
62 | 64 |
63 private: | 65 private: |
64 DISALLOW_COPY_AND_ASSIGN(BlimpClientContext); | 66 DISALLOW_COPY_AND_ASSIGN(BlimpClientContext); |
65 }; | 67 }; |
66 | 68 |
67 } // namespace client | 69 } // namespace client |
68 } // namespace blimp | 70 } // namespace blimp |
69 | 71 |
70 #endif // BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_H_ | 72 #endif // BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_H_ |
OLD | NEW |