OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "blimp/client/core/dummy_blimp_client_context.h" |
| 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/supports_user_data.h" |
| 9 #include "blimp/client/public/blimp_client_context_delegate.h" |
| 10 |
| 11 #if defined(OS_ANDROID) |
| 12 #include "blimp/client/core/android/dummy_blimp_client_context_android.h" |
| 13 #endif // OS_ANDROID |
| 14 |
| 15 namespace blimp { |
| 16 namespace client { |
| 17 |
| 18 namespace { |
| 19 |
| 20 #if defined(OS_ANDROID) |
| 21 const char kDummyBlimpClientContextAndroidKey[] = |
| 22 "dummy_blimp_client_context_android"; |
| 23 #endif // OS_ANDROID |
| 24 } |
| 25 |
| 26 // This function is declared in //blimp/client/public/blimp_client_context.h, |
| 27 // and either this function or the one in |
| 28 // //blimp/client/core/blimp_client_context_impl.cc should be linked in to |
| 29 // any binary using BlimpClientContext::Create. |
| 30 // static |
| 31 BlimpClientContext* BlimpClientContext::Create() { |
| 32 return new DummyBlimpClientContext(); |
| 33 } |
| 34 |
| 35 DummyBlimpClientContext::DummyBlimpClientContext() : BlimpClientContext() {} |
| 36 |
| 37 DummyBlimpClientContext::~DummyBlimpClientContext() {} |
| 38 |
| 39 #if defined(OS_ANDROID) |
| 40 |
| 41 base::android::ScopedJavaLocalRef<jobject> |
| 42 DummyBlimpClientContext::GetJavaObject() { |
| 43 return GetDummyBlimpClientContextAndroid()->GetJavaObject(); |
| 44 } |
| 45 |
| 46 DummyBlimpClientContextAndroid* |
| 47 DummyBlimpClientContext::GetDummyBlimpClientContextAndroid() { |
| 48 DummyBlimpClientContextAndroid* dummy_blimp_client_contents_android = |
| 49 static_cast<DummyBlimpClientContextAndroid*>( |
| 50 GetUserData(kDummyBlimpClientContextAndroidKey)); |
| 51 if (!dummy_blimp_client_contents_android) { |
| 52 dummy_blimp_client_contents_android = new DummyBlimpClientContextAndroid(); |
| 53 SetUserData(kDummyBlimpClientContextAndroidKey, |
| 54 dummy_blimp_client_contents_android); |
| 55 } |
| 56 return dummy_blimp_client_contents_android; |
| 57 } |
| 58 |
| 59 #endif // defined(OS_ANDROID) |
| 60 |
| 61 void DummyBlimpClientContext::SetDelegate( |
| 62 BlimpClientContextDelegate* delegate) {} |
| 63 |
| 64 std::unique_ptr<BlimpContents> DummyBlimpClientContext::CreateBlimpContents() { |
| 65 return nullptr; |
| 66 } |
| 67 |
| 68 } // namespace client |
| 69 } // namespace blimp |
OLD | NEW |