OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // OS_WIN | 10 #endif // OS_WIN |
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2333 | 2333 |
2334 // If script access is not allowed, create the the background contents in a | 2334 // If script access is not allowed, create the the background contents in a |
2335 // new SiteInstance, so that a separate process is used. | 2335 // new SiteInstance, so that a separate process is used. |
2336 scoped_refptr<content::SiteInstance> site_instance = | 2336 scoped_refptr<content::SiteInstance> site_instance = |
2337 allow_js_access ? | 2337 allow_js_access ? |
2338 opener_site_instance : | 2338 opener_site_instance : |
2339 content::SiteInstance::Create(opener_web_contents->GetBrowserContext()); | 2339 content::SiteInstance::Create(opener_web_contents->GetBrowserContext()); |
2340 | 2340 |
2341 // Passed all the checks, so this should be created as a BackgroundContents. | 2341 // Passed all the checks, so this should be created as a BackgroundContents. |
2342 BackgroundContents* contents = service->CreateBackgroundContents( | 2342 BackgroundContents* contents = service->CreateBackgroundContents( |
2343 site_instance, | 2343 site_instance.get(), |
2344 route_id, | 2344 route_id, |
2345 profile_, | 2345 profile_, |
2346 frame_name, | 2346 frame_name, |
2347 ASCIIToUTF16(extension->id())); | 2347 ASCIIToUTF16(extension->id())); |
2348 | 2348 |
2349 // When a separate process is used, the original renderer cannot access the | 2349 // When a separate process is used, the original renderer cannot access the |
2350 // new window later, thus we need to navigate the window now. | 2350 // new window later, thus we need to navigate the window now. |
2351 if (contents && !allow_js_access) { | 2351 if (contents && !allow_js_access) { |
2352 contents->web_contents()->GetController().LoadURL( | 2352 contents->web_contents()->GetController().LoadURL( |
2353 target_url, | 2353 target_url, |
2354 content::Referrer(), | 2354 content::Referrer(), |
2355 content::PAGE_TRANSITION_LINK, | 2355 content::PAGE_TRANSITION_LINK, |
2356 std::string()); // No extra headers. | 2356 std::string()); // No extra headers. |
2357 } | 2357 } |
2358 | 2358 |
2359 return contents != NULL; | 2359 return contents != NULL; |
2360 } | 2360 } |
OLD | NEW |