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