| 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 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2153 frame_name.empty() || | 2153 frame_name.empty() || |
| 2154 !extensions_service || | 2154 !extensions_service || |
| 2155 !extensions_service->is_ready()) | 2155 !extensions_service->is_ready()) |
| 2156 return false; | 2156 return false; |
| 2157 | 2157 |
| 2158 // Only hosted apps have web extents, so this ensures that only hosted apps | 2158 // Only hosted apps have web extents, so this ensures that only hosted apps |
| 2159 // can create BackgroundContents. We don't have to check for background | 2159 // can create BackgroundContents. We don't have to check for background |
| 2160 // permission as that is checked in RenderMessageFilter when the CreateWindow | 2160 // permission as that is checked in RenderMessageFilter when the CreateWindow |
| 2161 // message is processed. | 2161 // message is processed. |
| 2162 const Extension* extension = | 2162 const Extension* extension = |
| 2163 extensions_service->extensions()->GetHostedAppByURL( | 2163 extensions_service->extensions()->GetHostedAppByURL(opener_url); |
| 2164 ExtensionURLInfo(opener_url)); | |
| 2165 if (!extension) | 2164 if (!extension) |
| 2166 return false; | 2165 return false; |
| 2167 | 2166 |
| 2168 // No BackgroundContents allowed if BackgroundContentsService doesn't exist. | 2167 // No BackgroundContents allowed if BackgroundContentsService doesn't exist. |
| 2169 BackgroundContentsService* service = | 2168 BackgroundContentsService* service = |
| 2170 BackgroundContentsServiceFactory::GetForProfile(profile_); | 2169 BackgroundContentsServiceFactory::GetForProfile(profile_); |
| 2171 if (!service) | 2170 if (!service) |
| 2172 return false; | 2171 return false; |
| 2173 | 2172 |
| 2174 // Ensure that we're trying to open this from the extension's process. | 2173 // Ensure that we're trying to open this from the extension's process. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2215 if (contents && !allow_js_access) { | 2214 if (contents && !allow_js_access) { |
| 2216 contents->web_contents()->GetController().LoadURL( | 2215 contents->web_contents()->GetController().LoadURL( |
| 2217 target_url, | 2216 target_url, |
| 2218 content::Referrer(), | 2217 content::Referrer(), |
| 2219 content::PAGE_TRANSITION_LINK, | 2218 content::PAGE_TRANSITION_LINK, |
| 2220 std::string()); // No extra headers. | 2219 std::string()); // No extra headers. |
| 2221 } | 2220 } |
| 2222 | 2221 |
| 2223 return contents != NULL; | 2222 return contents != NULL; |
| 2224 } | 2223 } |
| OLD | NEW |