OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2189 } | 2189 } |
2190 | 2190 |
2191 // If script access is not allowed, create the the background contents in a | 2191 // If script access is not allowed, create the the background contents in a |
2192 // new SiteInstance, so that a separate process is used. | 2192 // new SiteInstance, so that a separate process is used. |
2193 scoped_refptr<content::SiteInstance> site_instance = | 2193 scoped_refptr<content::SiteInstance> site_instance = |
2194 allow_js_access ? | 2194 allow_js_access ? |
2195 opener_site_instance : | 2195 opener_site_instance : |
2196 content::SiteInstance::Create(opener_web_contents->GetBrowserContext()); | 2196 content::SiteInstance::Create(opener_web_contents->GetBrowserContext()); |
2197 | 2197 |
2198 // Passed all the checks, so this should be created as a BackgroundContents. | 2198 // Passed all the checks, so this should be created as a BackgroundContents. |
2199 BackgroundContents* contents = service->CreateBackgroundContents( | 2199 BackgroundContents* contents = |
2200 site_instance, | 2200 service->CreateBackgroundContents(site_instance.get(), |
2201 route_id, | 2201 route_id, |
2202 profile_, | 2202 profile_, |
2203 frame_name, | 2203 frame_name, |
2204 ASCIIToUTF16(extension->id())); | 2204 ASCIIToUTF16(extension->id())); |
2205 | 2205 |
2206 // When a separate process is used, the original renderer cannot access the | 2206 // When a separate process is used, the original renderer cannot access the |
2207 // new window later, thus we need to navigate the window now. | 2207 // new window later, thus we need to navigate the window now. |
2208 if (contents && !allow_js_access) { | 2208 if (contents && !allow_js_access) { |
2209 contents->web_contents()->GetController().LoadURL( | 2209 contents->web_contents()->GetController().LoadURL( |
2210 target_url, | 2210 target_url, |
2211 content::Referrer(), | 2211 content::Referrer(), |
2212 content::PAGE_TRANSITION_LINK, | 2212 content::PAGE_TRANSITION_LINK, |
2213 std::string()); // No extra headers. | 2213 std::string()); // No extra headers. |
2214 } | 2214 } |
2215 | 2215 |
2216 return contents != NULL; | 2216 return contents != NULL; |
2217 } | 2217 } |
OLD | NEW |