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/web_contents_factory.h" | 5 #include "chrome/browser/android/web_contents_factory.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
11 #include "content/public/browser/android/content_view_core.h" | 11 #include "content/public/browser/android/content_view_core.h" |
| 12 #include "content/public/browser/site_instance.h" |
12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
13 #include "jni/WebContentsFactory_jni.h" | 14 #include "jni/WebContentsFactory_jni.h" |
14 | 15 |
15 using base::android::JavaParamRef; | 16 using base::android::JavaParamRef; |
16 using base::android::ScopedJavaLocalRef; | 17 using base::android::ScopedJavaLocalRef; |
17 | 18 |
18 static ScopedJavaLocalRef<jobject> CreateWebContents( | 19 static ScopedJavaLocalRef<jobject> CreateWebContents( |
19 JNIEnv* env, | 20 JNIEnv* env, |
20 const JavaParamRef<jclass>& clazz, | 21 const JavaParamRef<jclass>& clazz, |
| 22 jint child_process_param_id, |
21 jboolean incognito, | 23 jboolean incognito, |
22 jboolean initially_hidden, | 24 jboolean initially_hidden, |
23 jboolean initialize_renderer) { | 25 jboolean initialize_renderer) { |
24 Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile(); | 26 Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile(); |
25 if (incognito) | 27 if (incognito) |
26 profile = profile->GetOffTheRecordProfile(); | 28 profile = profile->GetOffTheRecordProfile(); |
27 | 29 |
28 content::WebContents::CreateParams params(profile); | 30 content::WebContents::CreateParams params( |
| 31 profile, content::SiteInstance::Create(profile, child_process_param_id)); |
29 params.initially_hidden = static_cast<bool>(initially_hidden); | 32 params.initially_hidden = static_cast<bool>(initially_hidden); |
30 params.initialize_renderer = static_cast<bool>(initialize_renderer); | 33 params.initialize_renderer = static_cast<bool>(initialize_renderer); |
31 return content::WebContents::Create(params)->GetJavaWebContents(); | 34 return content::WebContents::Create(params)->GetJavaWebContents(); |
32 } | 35 } |
33 | 36 |
34 bool RegisterWebContentsFactory(JNIEnv* env) { | 37 bool RegisterWebContentsFactory(JNIEnv* env) { |
35 return RegisterNativesImpl(env); | 38 return RegisterNativesImpl(env); |
36 } | 39 } |
OLD | NEW |