| 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 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2204 frame_name.empty() || | 2204 frame_name.empty() || |
| 2205 !extensions_service || | 2205 !extensions_service || |
| 2206 !extensions_service->is_ready()) | 2206 !extensions_service->is_ready()) |
| 2207 return false; | 2207 return false; |
| 2208 | 2208 |
| 2209 // Only hosted apps have web extents, so this ensures that only hosted apps | 2209 // Only hosted apps have web extents, so this ensures that only hosted apps |
| 2210 // can create BackgroundContents. We don't have to check for background | 2210 // can create BackgroundContents. We don't have to check for background |
| 2211 // permission as that is checked in RenderMessageFilter when the CreateWindow | 2211 // permission as that is checked in RenderMessageFilter when the CreateWindow |
| 2212 // message is processed. | 2212 // message is processed. |
| 2213 const Extension* extension = | 2213 const Extension* extension = |
| 2214 extensions_service->extensions()->GetHostedAppByURL( | 2214 extensions_service->extensions()->GetHostedAppByURL(opener_url); |
| 2215 ExtensionURLInfo(opener_url)); | |
| 2216 if (!extension) | 2215 if (!extension) |
| 2217 return false; | 2216 return false; |
| 2218 | 2217 |
| 2219 // No BackgroundContents allowed if BackgroundContentsService doesn't exist. | 2218 // No BackgroundContents allowed if BackgroundContentsService doesn't exist. |
| 2220 BackgroundContentsService* service = | 2219 BackgroundContentsService* service = |
| 2221 BackgroundContentsServiceFactory::GetForProfile(profile_); | 2220 BackgroundContentsServiceFactory::GetForProfile(profile_); |
| 2222 if (!service) | 2221 if (!service) |
| 2223 return false; | 2222 return false; |
| 2224 | 2223 |
| 2225 // Ensure that we're trying to open this from the extension's process. | 2224 // 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... |
| 2266 if (contents && !allow_js_access) { | 2265 if (contents && !allow_js_access) { |
| 2267 contents->web_contents()->GetController().LoadURL( | 2266 contents->web_contents()->GetController().LoadURL( |
| 2268 target_url, | 2267 target_url, |
| 2269 content::Referrer(), | 2268 content::Referrer(), |
| 2270 content::PAGE_TRANSITION_LINK, | 2269 content::PAGE_TRANSITION_LINK, |
| 2271 std::string()); // No extra headers. | 2270 std::string()); // No extra headers. |
| 2272 } | 2271 } |
| 2273 | 2272 |
| 2274 return contents != NULL; | 2273 return contents != NULL; |
| 2275 } | 2274 } |
| OLD | NEW |