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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/client/core/dummy_blimp_client_context.cc
diff --git a/blimp/client/core/dummy_blimp_client_context.cc b/blimp/client/core/dummy_blimp_client_context.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d640253ef8478bd741cc9ea572bad356dee17497
--- /dev/null
+++ b/blimp/client/core/dummy_blimp_client_context.cc
@@ -0,0 +1,69 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "blimp/client/core/dummy_blimp_client_context.h"
+
+#include "base/memory/ptr_util.h"
+#include "base/supports_user_data.h"
+#include "blimp/client/public/blimp_client_context_delegate.h"
+
+#if defined(OS_ANDROID)
+#include "blimp/client/core/android/dummy_blimp_client_context_android.h"
+#endif // OS_ANDROID
+
+namespace blimp {
+namespace client {
+
+namespace {
+
+#if defined(OS_ANDROID)
+const char kDummyBlimpClientContextAndroidKey[] =
+ "dummy_blimp_client_context_android";
+#endif // OS_ANDROID
+}
+
+// This function is declared in //blimp/client/public/blimp_client_context.h,
+// and either this function or the one in
+// //blimp/client/core/blimp_client_context_impl.cc should be linked in to
+// any binary using BlimpClientContext::Create.
+// static
+BlimpClientContext* BlimpClientContext::Create() {
+ return new DummyBlimpClientContext();
+}
+
+DummyBlimpClientContext::DummyBlimpClientContext() : BlimpClientContext() {}
+
+DummyBlimpClientContext::~DummyBlimpClientContext() {}
+
+#if defined(OS_ANDROID)
+
+base::android::ScopedJavaLocalRef<jobject>
+DummyBlimpClientContext::GetJavaObject() {
+ return GetDummyBlimpClientContextAndroid()->GetJavaObject();
+}
+
+DummyBlimpClientContextAndroid*
+DummyBlimpClientContext::GetDummyBlimpClientContextAndroid() {
+ DummyBlimpClientContextAndroid* dummy_blimp_client_contents_android =
+ static_cast<DummyBlimpClientContextAndroid*>(
+ GetUserData(kDummyBlimpClientContextAndroidKey));
+ if (!dummy_blimp_client_contents_android) {
+ dummy_blimp_client_contents_android = new DummyBlimpClientContextAndroid();
+ SetUserData(kDummyBlimpClientContextAndroidKey,
+ dummy_blimp_client_contents_android);
+ }
+ return dummy_blimp_client_contents_android;
+}
+
+#endif // defined(OS_ANDROID)
+
+void DummyBlimpClientContext::SetDelegate(
+ BlimpClientContextDelegate* delegate) {}
+
+std::unique_ptr<BlimpContents> DummyBlimpClientContext::CreateBlimpContents() {
+ return nullptr;
+}
+
+} // namespace client
+} // namespace blimp
« 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