| 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 "chrome/browser/android/service_tab_launcher.h" | 5 #include "chrome/browser/android/service_tab_launcher.h" |
| 6 | 6 |
| 7 #include "base/android/context_utils.h" | 7 #include "base/android/context_utils.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| 11 #include "content/public/browser/page_navigator.h" | 11 #include "content/public/browser/page_navigator.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "jni/ServiceTabLauncher_jni.h" | 13 #include "jni/ServiceTabLauncher_jni.h" |
| 14 | 14 |
| 15 using base::android::AttachCurrentThread; | 15 using base::android::AttachCurrentThread; |
| 16 using base::android::ConvertUTF8ToJavaString; | 16 using base::android::ConvertUTF8ToJavaString; |
| 17 using base::android::GetApplicationContext; | 17 using base::android::GetApplicationContext; |
| 18 using base::android::JavaParamRef; |
| 19 using base::android::ScopedJavaLocalRef; |
| 18 | 20 |
| 19 // Called by Java when the WebContents instance for a request Id is available. | 21 // Called by Java when the WebContents instance for a request Id is available. |
| 20 void OnWebContentsForRequestAvailable( | 22 void OnWebContentsForRequestAvailable( |
| 21 JNIEnv* env, | 23 JNIEnv* env, |
| 22 const JavaParamRef<jclass>& clazz, | 24 const JavaParamRef<jclass>& clazz, |
| 23 jint request_id, | 25 jint request_id, |
| 24 const JavaParamRef<jobject>& android_web_contents) { | 26 const JavaParamRef<jobject>& android_web_contents) { |
| 25 ServiceTabLauncher::GetInstance()->OnTabLaunched( | 27 ServiceTabLauncher::GetInstance()->OnTabLaunched( |
| 26 request_id, | 28 request_id, |
| 27 content::WebContents::FromJavaWebContents(android_web_contents)); | 29 content::WebContents::FromJavaWebContents(android_web_contents)); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 83 |
| 82 if (callback) | 84 if (callback) |
| 83 callback->Run(web_contents); | 85 callback->Run(web_contents); |
| 84 | 86 |
| 85 tab_launched_callbacks_.Remove(request_id); | 87 tab_launched_callbacks_.Remove(request_id); |
| 86 } | 88 } |
| 87 | 89 |
| 88 bool ServiceTabLauncher::Register(JNIEnv* env) { | 90 bool ServiceTabLauncher::Register(JNIEnv* env) { |
| 89 return RegisterNativesImpl(env); | 91 return RegisterNativesImpl(env); |
| 90 } | 92 } |
| OLD | NEW |