| 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 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2180 frame_name.empty() || | 2180 frame_name.empty() || |
| 2181 !extensions_service || | 2181 !extensions_service || |
| 2182 !extensions_service->is_ready()) | 2182 !extensions_service->is_ready()) |
| 2183 return false; | 2183 return false; |
| 2184 | 2184 |
| 2185 // Only hosted apps have web extents, so this ensures that only hosted apps | 2185 // Only hosted apps have web extents, so this ensures that only hosted apps |
| 2186 // can create BackgroundContents. We don't have to check for background | 2186 // can create BackgroundContents. We don't have to check for background |
| 2187 // permission as that is checked in RenderMessageFilter when the CreateWindow | 2187 // permission as that is checked in RenderMessageFilter when the CreateWindow |
| 2188 // message is processed. | 2188 // message is processed. |
| 2189 const Extension* extension = | 2189 const Extension* extension = |
| 2190 extensions_service->extensions()->GetHostedAppByURL( | 2190 extensions_service->extensions()->GetHostedAppByURL(opener_url); |
| 2191 ExtensionURLInfo(opener_url)); | |
| 2192 if (!extension) | 2191 if (!extension) |
| 2193 return false; | 2192 return false; |
| 2194 | 2193 |
| 2195 // No BackgroundContents allowed if BackgroundContentsService doesn't exist. | 2194 // No BackgroundContents allowed if BackgroundContentsService doesn't exist. |
| 2196 BackgroundContentsService* service = | 2195 BackgroundContentsService* service = |
| 2197 BackgroundContentsServiceFactory::GetForProfile(profile_); | 2196 BackgroundContentsServiceFactory::GetForProfile(profile_); |
| 2198 if (!service) | 2197 if (!service) |
| 2199 return false; | 2198 return false; |
| 2200 | 2199 |
| 2201 // Ensure that we're trying to open this from the extension's process. | 2200 // 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... |
| 2242 if (contents && !allow_js_access) { | 2241 if (contents && !allow_js_access) { |
| 2243 contents->web_contents()->GetController().LoadURL( | 2242 contents->web_contents()->GetController().LoadURL( |
| 2244 target_url, | 2243 target_url, |
| 2245 content::Referrer(), | 2244 content::Referrer(), |
| 2246 content::PAGE_TRANSITION_LINK, | 2245 content::PAGE_TRANSITION_LINK, |
| 2247 std::string()); // No extra headers. | 2246 std::string()); // No extra headers. |
| 2248 } | 2247 } |
| 2249 | 2248 |
| 2250 return contents != NULL; | 2249 return contents != NULL; |
| 2251 } | 2250 } |
| OLD | NEW |