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