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

Unified Diff: content/browser/android/service_registry_android_impl.cc

Issue 1831173002: Scaffolding for Android implementation of PaymentRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo
Patch Set: thestig@ & esprehn@ comments Created 4 years, 8 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
Index: content/browser/android/service_registry_android_impl.cc
diff --git a/content/browser/mojo/service_registry_android.cc b/content/browser/android/service_registry_android_impl.cc
similarity index 65%
rename from content/browser/mojo/service_registry_android.cc
rename to content/browser/android/service_registry_android_impl.cc
index 0e80e0842b589da6f1d7a33379291e7aa26df091..e54c3610a29d5ec7332587beb8c488c66368bc2e 100644
--- a/content/browser/mojo/service_registry_android.cc
+++ b/content/browser/android/service_registry_android_impl.cc
@@ -1,16 +1,18 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// 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 "content/browser/mojo/service_registry_android.h"
+#include "content/browser/android/service_registry_android_impl.h"
#include <utility>
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/callback.h"
-#include "content/common/mojo/service_registry_impl.h"
+#include "base/memory/ptr_util.h"
+#include "content/public/common/service_registry.h"
#include "jni/ServiceRegistry_jni.h"
+#include "mojo/public/cpp/system/message_pipe.h"
using base::android::AttachCurrentThread;
using base::android::ConvertJavaStringToUTF8;
@@ -28,23 +30,31 @@ void CreateImplAndAttach(
const ScopedJavaGlobalRef<jobject>& j_scoped_factory,
mojo::ScopedMessagePipeHandle handle) {
JNIEnv* env = AttachCurrentThread();
- Java_ServiceRegistry_createImplAndAttach(env,
- j_scoped_service_registry.obj(),
- handle.release().value(),
- j_scoped_manager.obj(),
- j_scoped_factory.obj());
+ Java_ServiceRegistry_createImplAndAttach(
+ env, j_scoped_service_registry.obj(), handle.release().value(),
+ j_scoped_manager.obj(), j_scoped_factory.obj());
}
} // namespace
// static
-bool ServiceRegistryAndroid::Register(JNIEnv* env) {
+std::unique_ptr<ServiceRegistryAndroid> ServiceRegistryAndroid::Create(
+ ServiceRegistry* registry) {
+ return base::WrapUnique(new ServiceRegistryAndroidImpl(registry));
+}
+
+// static
+bool ServiceRegistryAndroidImpl::Register(JNIEnv* env) {
return RegisterNativesImpl(env);
}
+ServiceRegistryAndroidImpl::~ServiceRegistryAndroidImpl() {
+ Java_ServiceRegistry_destroy(AttachCurrentThread(), obj_.obj());
+}
+
// Constructor and destructor call into Java.
-ServiceRegistryAndroid::ServiceRegistryAndroid(
- ServiceRegistryImpl* service_registry)
+ServiceRegistryAndroidImpl::ServiceRegistryAndroidImpl(
+ ServiceRegistry* service_registry)
: service_registry_(service_registry) {
JNIEnv* env = AttachCurrentThread();
obj_.Reset(
@@ -52,12 +62,13 @@ ServiceRegistryAndroid::ServiceRegistryAndroid(
Java_ServiceRegistry_create(env, reinterpret_cast<intptr_t>(this)).obj());
}
-ServiceRegistryAndroid::~ServiceRegistryAndroid() {
- Java_ServiceRegistry_destroy(AttachCurrentThread(), obj_.obj());
+const base::android::ScopedJavaGlobalRef<jobject>&
+ServiceRegistryAndroidImpl::GetObj() {
+ return obj_;
}
// Methods called from Java.
-void ServiceRegistryAndroid::AddService(
+void ServiceRegistryAndroidImpl::AddService(
JNIEnv* env,
const JavaParamRef<jobject>& j_service_registry,
const JavaParamRef<jobject>& j_manager,
@@ -74,14 +85,12 @@ void ServiceRegistryAndroid::AddService(
ScopedJavaGlobalRef<jobject> j_scoped_factory;
j_scoped_factory.Reset(env, j_factory);
- service_registry_->AddService(name,
- base::Bind(&CreateImplAndAttach,
- j_scoped_service_registry,
- j_scoped_manager,
- j_scoped_factory));
+ service_registry_->AddService(
+ name, base::Bind(&CreateImplAndAttach, j_scoped_service_registry,
+ j_scoped_manager, j_scoped_factory));
}
-void ServiceRegistryAndroid::RemoveService(
+void ServiceRegistryAndroidImpl::RemoveService(
JNIEnv* env,
const JavaParamRef<jobject>& j_service_registry,
const JavaParamRef<jstring>& j_name) {
@@ -89,7 +98,7 @@ void ServiceRegistryAndroid::RemoveService(
service_registry_->RemoveService(name);
}
-void ServiceRegistryAndroid::ConnectToRemoteService(
+void ServiceRegistryAndroidImpl::ConnectToRemoteService(
JNIEnv* env,
const JavaParamRef<jobject>& j_service_registry,
const JavaParamRef<jstring>& j_name,
« no previous file with comments | « content/browser/android/service_registry_android_impl.h ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698