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 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 if (!opener_url.is_valid() || | 2433 if (!opener_url.is_valid() || |
2434 frame_name.empty() || | 2434 frame_name.empty() || |
2435 !extensions_service || | 2435 !extensions_service || |
2436 !extensions_service->is_ready()) | 2436 !extensions_service->is_ready()) |
2437 return false; | 2437 return false; |
2438 | 2438 |
2439 // Only hosted apps have web extents, so this ensures that only hosted apps | 2439 // Only hosted apps have web extents, so this ensures that only hosted apps |
2440 // can create BackgroundContents. We don't have to check for background | 2440 // can create BackgroundContents. We don't have to check for background |
2441 // permission as that is checked in RenderMessageFilter when the CreateWindow | 2441 // permission as that is checked in RenderMessageFilter when the CreateWindow |
2442 // message is processed. | 2442 // message is processed. |
2443 const Extension* extension = | 2443 const Extension* extension = extensions::ExtensionRegistry::Get(profile_) |
2444 extensions_service->extensions()->GetHostedAppByURL(opener_url); | 2444 ->enabled_extensions() |
| 2445 .GetHostedAppByURL(opener_url); |
2445 if (!extension) | 2446 if (!extension) |
2446 return false; | 2447 return false; |
2447 | 2448 |
2448 // No BackgroundContents allowed if BackgroundContentsService doesn't exist. | 2449 // No BackgroundContents allowed if BackgroundContentsService doesn't exist. |
2449 BackgroundContentsService* service = | 2450 BackgroundContentsService* service = |
2450 BackgroundContentsServiceFactory::GetForProfile(profile_); | 2451 BackgroundContentsServiceFactory::GetForProfile(profile_); |
2451 if (!service) | 2452 if (!service) |
2452 return false; | 2453 return false; |
2453 | 2454 |
2454 // Ensure that we're trying to open this from the extension's process. | 2455 // Ensure that we're trying to open this from the extension's process. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2496 if (contents && !allow_js_access) { | 2497 if (contents && !allow_js_access) { |
2497 contents->web_contents()->GetController().LoadURL( | 2498 contents->web_contents()->GetController().LoadURL( |
2498 target_url, | 2499 target_url, |
2499 content::Referrer(), | 2500 content::Referrer(), |
2500 ui::PAGE_TRANSITION_LINK, | 2501 ui::PAGE_TRANSITION_LINK, |
2501 std::string()); // No extra headers. | 2502 std::string()); // No extra headers. |
2502 } | 2503 } |
2503 | 2504 |
2504 return contents != NULL; | 2505 return contents != NULL; |
2505 } | 2506 } |
OLD | NEW |