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

Side by Side Diff: blimp/client/core/android/blimp_contents_observer_proxy.cc

Issue 2166563003: Split //blimp/client/core to relevant parts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-assignment-source
Patch Set: 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
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/android/blimp_contents_observer_proxy.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 "blimp/client/core/android/blimp_contents_impl_android.h"
11 #include "jni/BlimpContentsObserverProxy_jni.h"
12
13 namespace blimp {
14 namespace client {
15
16 jlong Init(JNIEnv* env,
17 const base::android::JavaParamRef<jobject>& jobj,
18 const base::android::JavaParamRef<jobject>& jblimp_contents_impl) {
19 BlimpContentsImplAndroid* blimp_contents_impl_android =
20 BlimpContentsImplAndroid::FromJavaObject(env, jblimp_contents_impl.obj());
21 CHECK(blimp_contents_impl_android);
22
23 return reinterpret_cast<intptr_t>(
24 new BlimpContentsObserverProxy(env, jobj, blimp_contents_impl_android));
25 }
26
27 // static
28 bool BlimpContentsObserverProxy::RegisterJni(JNIEnv* env) {
29 return RegisterNativesImpl(env);
30 }
31
32 BlimpContentsObserverProxy::BlimpContentsObserverProxy(
33 JNIEnv* env,
34 jobject obj,
35 BlimpContentsImplAndroid* blimp_contents_impl_android)
36 : blimp_contents_impl_android_(blimp_contents_impl_android) {
37 java_obj_.Reset(env, obj);
38 blimp_contents_impl_android_->blimp_contents_impl()->AddObserver(this);
39 }
40
41 BlimpContentsObserverProxy::~BlimpContentsObserverProxy() {}
42
43 void BlimpContentsObserverProxy::Destroy(
44 JNIEnv* env,
45 const base::android::JavaParamRef<jobject>& jobj) {
46 blimp_contents_impl_android_->blimp_contents_impl()->RemoveObserver(this);
47 delete this;
48 }
49
50 void BlimpContentsObserverProxy::OnURLUpdated(const GURL& url) {
51 JNIEnv* env = base::android::AttachCurrentThread();
52 base::android::ScopedJavaLocalRef<jobject> obj(java_obj_);
53 base::android::ScopedJavaLocalRef<jstring> jstring_url(
54 base::android::ConvertUTF8ToJavaString(env, url.spec()));
55
56 Java_BlimpContentsObserverProxy_onUrlUpdated(env, obj.obj(),
57 jstring_url.obj());
58 }
59
60 } // namespace client
61 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/core/android/blimp_contents_observer_proxy.h ('k') | blimp/client/core/android/blimp_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698