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

Side by Side Diff: chrome/browser/android/blimp/chrome_blimp_client_context_delegate_android.cc

Issue 2623023002: Remove //chrome as an embedder of blimp. (Closed)
Patch Set: One more rebase for good measure Created 3 years, 11 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
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 "chrome/browser/android/blimp/chrome_blimp_client_context_delegate_andr oid.h"
6
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h"
10 #include "base/memory/ptr_util.h"
11 #include "chrome/browser/android/blimp/chrome_blimp_client_context_delegate.h"
12 #include "chrome/browser/profiles/profile_android.h"
13 #include "jni/ChromeBlimpClientContextDelegate_jni.h"
14
15 // static
16 bool ChromeBlimpClientContextDelegateAndroid::RegisterJni(JNIEnv* env) {
17 return RegisterNativesImpl(env);
18 }
19
20 // static
21 static jlong Init(JNIEnv* env,
22 const base::android::JavaParamRef<jobject>& jobj,
23 const base::android::JavaParamRef<jobject>& jprofile) {
24 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile.obj());
25 return reinterpret_cast<intptr_t>(
26 new ChromeBlimpClientContextDelegateAndroid(env, jobj, profile));
27 }
28
29 ChromeBlimpClientContextDelegateAndroid::
30 ChromeBlimpClientContextDelegateAndroid(JNIEnv* env,
31 jobject jobj,
32 Profile* profile)
33 : ChromeBlimpClientContextDelegate(profile) {
34 java_obj_.Reset(env, jobj);
35 }
36
37 void ChromeBlimpClientContextDelegateAndroid::Destroy(
38 JNIEnv* env,
39 const base::android::JavaParamRef<jobject>& jobj) {
40 delete this;
41 }
42
43 ChromeBlimpClientContextDelegateAndroid::
44 ~ChromeBlimpClientContextDelegateAndroid() {
45 Java_ChromeBlimpClientContextDelegate_clearNativePtr(
46 base::android::AttachCurrentThread(), java_obj_);
47 }
48
49 void ChromeBlimpClientContextDelegateAndroid::ShowMessage(
50 const base::string16& message,
51 bool short_message) {
52 JNIEnv* env = base::android::AttachCurrentThread();
53 base::android::ScopedJavaLocalRef<jstring> jmessage(
54 base::android::ConvertUTF16ToJavaString(env, message));
55 Java_ChromeBlimpClientContextDelegate_showMessage(env, java_obj_, jmessage,
56 short_message);
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698