| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/android/web_contents_observer_proxy.h" | 5 #include "content/browser/android/web_contents_observer_proxy.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 jobject obj, | 29 jobject obj, |
| 30 WebContents* web_contents) | 30 WebContents* web_contents) |
| 31 : WebContentsObserver(web_contents) { | 31 : WebContentsObserver(web_contents) { |
| 32 DCHECK(obj); | 32 DCHECK(obj); |
| 33 java_observer_.Reset(env, obj); | 33 java_observer_.Reset(env, obj); |
| 34 } | 34 } |
| 35 | 35 |
| 36 WebContentsObserverProxy::~WebContentsObserverProxy() { | 36 WebContentsObserverProxy::~WebContentsObserverProxy() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 jlong Init(JNIEnv* env, jobject obj, jobject java_web_contents) { | 39 jlong Init(JNIEnv* env, |
| 40 const JavaParamRef<jobject>& obj, |
| 41 const JavaParamRef<jobject>& java_web_contents) { |
| 40 WebContents* web_contents = | 42 WebContents* web_contents = |
| 41 WebContents::FromJavaWebContents(java_web_contents); | 43 WebContents::FromJavaWebContents(java_web_contents); |
| 42 CHECK(web_contents); | 44 CHECK(web_contents); |
| 43 | 45 |
| 44 WebContentsObserverProxy* native_observer = | 46 WebContentsObserverProxy* native_observer = |
| 45 new WebContentsObserverProxy(env, obj, web_contents); | 47 new WebContentsObserverProxy(env, obj, web_contents); |
| 46 return reinterpret_cast<intptr_t>(native_observer); | 48 return reinterpret_cast<intptr_t>(native_observer); |
| 47 } | 49 } |
| 48 | 50 |
| 49 void WebContentsObserverProxy::Destroy(JNIEnv* env, jobject obj) { | 51 void WebContentsObserverProxy::Destroy(JNIEnv* env, jobject obj) { |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 ScopedJavaLocalRef<jobject> obj(java_observer_); | 297 ScopedJavaLocalRef<jobject> obj(java_observer_); |
| 296 | 298 |
| 297 Java_WebContentsObserverProxy_mediaSessionStateChanged( | 299 Java_WebContentsObserverProxy_mediaSessionStateChanged( |
| 298 env, obj.obj(), is_controllable, is_suspended); | 300 env, obj.obj(), is_controllable, is_suspended); |
| 299 } | 301 } |
| 300 | 302 |
| 301 bool RegisterWebContentsObserverProxy(JNIEnv* env) { | 303 bool RegisterWebContentsObserverProxy(JNIEnv* env) { |
| 302 return RegisterNativesImpl(env); | 304 return RegisterNativesImpl(env); |
| 303 } | 305 } |
| 304 } // namespace content | 306 } // namespace content |
| OLD | NEW |