| 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/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 extension->id(), | 1320 extension->id(), |
| 1321 site_instance->GetProcess()->GetID(), | 1321 site_instance->GetProcess()->GetID(), |
| 1322 site_instance->GetId())); | 1322 site_instance->GetId())); |
| 1323 } | 1323 } |
| 1324 | 1324 |
| 1325 bool ChromeContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation( | 1325 bool ChromeContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation( |
| 1326 SiteInstance* site_instance, | 1326 SiteInstance* site_instance, |
| 1327 const GURL& current_url, | 1327 const GURL& current_url, |
| 1328 const GURL& new_url) { | 1328 const GURL& new_url) { |
| 1329 // If we don't have an ExtensionService, then rely on the SiteInstance logic | 1329 // If we don't have an ExtensionService, then rely on the SiteInstance logic |
| 1330 // in RenderViewHostManager to decide when to swap. | 1330 // in RenderFrameHostManager to decide when to swap. |
| 1331 Profile* profile = | 1331 Profile* profile = |
| 1332 Profile::FromBrowserContext(site_instance->GetBrowserContext()); | 1332 Profile::FromBrowserContext(site_instance->GetBrowserContext()); |
| 1333 ExtensionService* service = | 1333 ExtensionService* service = |
| 1334 extensions::ExtensionSystem::Get(profile)->extension_service(); | 1334 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 1335 if (!service) | 1335 if (!service) |
| 1336 return false; | 1336 return false; |
| 1337 | 1337 |
| 1338 // We must use a new BrowsingInstance (forcing a process swap and disabling | 1338 // We must use a new BrowsingInstance (forcing a process swap and disabling |
| 1339 // scripting by existing tabs) if one of the URLs is an extension and the | 1339 // scripting by existing tabs) if one of the URLs is an extension and the |
| 1340 // other is not the exact same extension. | 1340 // other is not the exact same extension. |
| 1341 // | 1341 // |
| 1342 // We ignore hosted apps here so that other tabs in their BrowsingInstance can | 1342 // We ignore hosted apps here so that other tabs in their BrowsingInstance can |
| 1343 // use postMessage with them. (The exception is the Chrome Web Store, which | 1343 // use postMessage with them. (The exception is the Chrome Web Store, which |
| 1344 // is a hosted app that requires its own BrowsingInstance.) Navigations | 1344 // is a hosted app that requires its own BrowsingInstance.) Navigations |
| 1345 // to/from a hosted app will still trigger a SiteInstance swap in | 1345 // to/from a hosted app will still trigger a SiteInstance swap in |
| 1346 // RenderViewHostManager. | 1346 // RenderFrameHostManager. |
| 1347 const Extension* current_extension = | 1347 const Extension* current_extension = |
| 1348 service->extensions()->GetExtensionOrAppByURL(current_url); | 1348 service->extensions()->GetExtensionOrAppByURL(current_url); |
| 1349 if (current_extension && | 1349 if (current_extension && |
| 1350 current_extension->is_hosted_app() && | 1350 current_extension->is_hosted_app() && |
| 1351 current_extension->id() != extension_misc::kWebStoreAppId) | 1351 current_extension->id() != extension_misc::kWebStoreAppId) |
| 1352 current_extension = NULL; | 1352 current_extension = NULL; |
| 1353 | 1353 |
| 1354 const Extension* new_extension = | 1354 const Extension* new_extension = |
| 1355 service->extensions()->GetExtensionOrAppByURL(new_url); | 1355 service->extensions()->GetExtensionOrAppByURL(new_url); |
| 1356 if (new_extension && | 1356 if (new_extension && |
| (...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2639 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, | 2639 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
| 2640 allowed_file_handle_origins_) || | 2640 allowed_file_handle_origins_) || |
| 2641 IsHostAllowedByCommandLine(url, extension_set, | 2641 IsHostAllowedByCommandLine(url, extension_set, |
| 2642 switches::kAllowNaClFileHandleAPI); | 2642 switches::kAllowNaClFileHandleAPI); |
| 2643 #else | 2643 #else |
| 2644 return false; | 2644 return false; |
| 2645 #endif | 2645 #endif |
| 2646 } | 2646 } |
| 2647 | 2647 |
| 2648 } // namespace chrome | 2648 } // namespace chrome |
| OLD | NEW |