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/ui/android/tab_model/single_tab_model.h" | 5 #include "chrome/browser/ui/android/tab_model/single_tab_model.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "chrome/browser/android/tab_android.h" | 8 #include "chrome/browser/android/tab_android.h" |
9 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 9 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
11 #include "jni/SingleTabModel_jni.h" | 11 #include "jni/SingleTabModel_jni.h" |
12 | 12 |
| 13 using base::android::JavaParamRef; |
| 14 |
13 static void PermanentlyBlockAllNewWindows( | 15 static void PermanentlyBlockAllNewWindows( |
14 JNIEnv* env, | 16 JNIEnv* env, |
15 const JavaParamRef<jclass>& clazz, | 17 const JavaParamRef<jclass>& clazz, |
16 const JavaParamRef<jobject>& j_tab_android) { | 18 const JavaParamRef<jobject>& j_tab_android) { |
17 TabAndroid* tab = TabAndroid::GetNativeTab(env, j_tab_android); | 19 TabAndroid* tab = TabAndroid::GetNativeTab(env, j_tab_android); |
18 if (!tab) | 20 if (!tab) |
19 return; | 21 return; |
20 | 22 |
21 content::WebContents* web_contents = tab->web_contents(); | 23 content::WebContents* web_contents = tab->web_contents(); |
22 if (!web_contents) | 24 if (!web_contents) |
23 return; | 25 return; |
24 | 26 |
25 SingleTabModeTabHelper* tab_helper = | 27 SingleTabModeTabHelper* tab_helper = |
26 SingleTabModeTabHelper::FromWebContents(web_contents); | 28 SingleTabModeTabHelper::FromWebContents(web_contents); |
27 tab_helper->PermanentlyBlockAllNewWindows(); | 29 tab_helper->PermanentlyBlockAllNewWindows(); |
28 } | 30 } |
29 | 31 |
30 // Register native methods | 32 // Register native methods |
31 bool RegisterSingleTabModel(JNIEnv* env) { | 33 bool RegisterSingleTabModel(JNIEnv* env) { |
32 return RegisterNativesImpl(env); | 34 return RegisterNativesImpl(env); |
33 } | 35 } |
OLD | NEW |