Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: blimp/client/core/dummy_blimp_client_context.cc

Issue 2132163002: Add BlimpClientContext and factory with real and dummy implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-blimp-client-core-public-to-blimp-client
Patch Set: git merge origin/master before CQ for good measure Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « blimp/client/core/dummy_blimp_client_context.h ('k') | blimp/client/public/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « blimp/client/core/dummy_blimp_client_context.h ('k') | blimp/client/public/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698