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 "components/service_tab_launcher/browser/android/service_tab_launcher.h
" | 5 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h
" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
10 #include "content/public/browser/page_navigator.h" | 10 #include "content/public/browser/page_navigator.h" |
11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
12 #include "jni/ServiceTabLauncher_jni.h" | 12 #include "jni/ServiceTabLauncher_jni.h" |
13 | 13 |
14 using base::android::AttachCurrentThread; | 14 using base::android::AttachCurrentThread; |
15 using base::android::ConvertUTF8ToJavaString; | 15 using base::android::ConvertUTF8ToJavaString; |
16 using base::android::GetApplicationContext; | 16 using base::android::GetApplicationContext; |
17 | 17 |
18 // Called by Java when the WebContents instance for a request Id is available. | 18 // Called by Java when the WebContents instance for a request Id is available. |
19 void OnWebContentsForRequestAvailable( | 19 void OnWebContentsForRequestAvailable( |
20 JNIEnv* env, jclass clazz, jint request_id, jobject android_web_contents) { | 20 JNIEnv* env, |
| 21 const JavaParamRef<jclass>& clazz, |
| 22 jint request_id, |
| 23 const JavaParamRef<jobject>& android_web_contents) { |
21 service_tab_launcher::ServiceTabLauncher::GetInstance()->OnTabLaunched( | 24 service_tab_launcher::ServiceTabLauncher::GetInstance()->OnTabLaunched( |
22 request_id, | 25 request_id, |
23 content::WebContents::FromJavaWebContents(android_web_contents)); | 26 content::WebContents::FromJavaWebContents(android_web_contents)); |
24 } | 27 } |
25 | 28 |
26 namespace service_tab_launcher { | 29 namespace service_tab_launcher { |
27 | 30 |
28 // static | 31 // static |
29 ServiceTabLauncher* ServiceTabLauncher::GetInstance() { | 32 ServiceTabLauncher* ServiceTabLauncher::GetInstance() { |
30 return Singleton<ServiceTabLauncher>::get(); | 33 return Singleton<ServiceTabLauncher>::get(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 callback->Run(web_contents); | 95 callback->Run(web_contents); |
93 | 96 |
94 tab_launched_callbacks_.Remove(request_id); | 97 tab_launched_callbacks_.Remove(request_id); |
95 } | 98 } |
96 | 99 |
97 bool ServiceTabLauncher::RegisterServiceTabLauncher(JNIEnv* env) { | 100 bool ServiceTabLauncher::RegisterServiceTabLauncher(JNIEnv* env) { |
98 return RegisterNativesImpl(env); | 101 return RegisterNativesImpl(env); |
99 } | 102 } |
100 | 103 |
101 } // namespace service_tab_launcher | 104 } // namespace service_tab_launcher |
OLD | NEW |