| 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" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/supports_user_data.h" | |
| 15 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 16 #include "blimp/client/core/session/client_network_components.h" | 15 #include "blimp/client/core/session/client_network_components.h" |
| 17 #include "blimp/client/core/session/network_event_observer.h" | 16 #include "blimp/client/core/session/network_event_observer.h" |
| 18 #include "blimp/client/public/blimp_client_context.h" | 17 #include "blimp/client/public/blimp_client_context.h" |
| 19 #include "blimp/client/public/contents/blimp_contents.h" | 18 #include "blimp/client/public/contents/blimp_contents.h" |
| 20 #include "blimp/net/blimp_connection_statistics.h" | 19 #include "blimp/net/blimp_connection_statistics.h" |
| 21 #include "blimp/net/thread_pipe_manager.h" | 20 #include "blimp/net/thread_pipe_manager.h" |
| 22 | 21 |
| 23 #if defined(OS_ANDROID) | |
| 24 #include "base/android/jni_android.h" | |
| 25 #endif // defined(OS_ANDROID) | |
| 26 | |
| 27 namespace blimp { | 22 namespace blimp { |
| 28 namespace client { | 23 namespace client { |
| 29 | 24 |
| 30 #if defined(OS_ANDROID) | |
| 31 class BlimpClientContextImplAndroid; | |
| 32 #endif // defined(OS_ANDROID) | |
| 33 | |
| 34 // BlimpClientContextImpl is the implementation of the main context-class for | 25 // BlimpClientContextImpl is the implementation of the main context-class for |
| 35 // the blimp client. | 26 // the blimp client. |
| 36 class BlimpClientContextImpl : public BlimpClientContext, | 27 class BlimpClientContextImpl : public BlimpClientContext, |
| 37 public NetworkEventObserver, | 28 public NetworkEventObserver { |
| 38 base::SupportsUserData { | |
| 39 public: | 29 public: |
| 40 // The |io_thread_task_runner| must be the task runner to use for IO | 30 // The |io_thread_task_runner| must be the task runner to use for IO |
| 41 // operations. | 31 // operations. |
| 42 explicit BlimpClientContextImpl( | 32 explicit BlimpClientContextImpl( |
| 43 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner); | 33 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner); |
| 44 ~BlimpClientContextImpl() override; | 34 ~BlimpClientContextImpl() override; |
| 45 | 35 |
| 46 #if defined(OS_ANDROID) | 36 // BlimpClientContext implementation. |
| 47 BlimpClientContextImplAndroid* GetBlimpClientContextImplAndroid(); | |
| 48 #endif // defined(OS_ANDROID) | |
| 49 | |
| 50 // BlimpClientContext implementation. | |
| 51 #if defined(OS_ANDROID) | |
| 52 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; | |
| 53 #endif // defined(OS_ANDROID) | |
| 54 void SetDelegate(BlimpClientContextDelegate* delegate) override; | 37 void SetDelegate(BlimpClientContextDelegate* delegate) override; |
| 55 std::unique_ptr<BlimpContents> CreateBlimpContents() override; | 38 std::unique_ptr<BlimpContents> CreateBlimpContents() override; |
| 56 | 39 |
| 57 // NetworkEventObserver implementation. | 40 // NetworkEventObserver implementation. |
| 58 void OnConnected() override; | 41 void OnConnected() override; |
| 59 void OnDisconnected(int result) override; | 42 void OnDisconnected(int result) override; |
| 60 | 43 |
| 61 private: | 44 private: |
| 62 // Provides functionality from the embedder. | 45 // Provides functionality from the embedder. |
| 63 BlimpClientContextDelegate* delegate_; | 46 BlimpClientContextDelegate* delegate_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 77 | 60 |
| 78 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; | 61 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; |
| 79 | 62 |
| 80 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); | 63 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); |
| 81 }; | 64 }; |
| 82 | 65 |
| 83 } // namespace client | 66 } // namespace client |
| 84 } // namespace blimp | 67 } // namespace blimp |
| 85 | 68 |
| 86 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ | 69 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ |
| OLD | NEW |