| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 if (!service) | 431 if (!service) |
| 432 return; | 432 return; |
| 433 | 433 |
| 434 const Extension* extension = | 434 const Extension* extension = |
| 435 service->GetExtensionByURL(site_instance->site()); | 435 service->GetExtensionByURL(site_instance->site()); |
| 436 if (!extension) | 436 if (!extension) |
| 437 extension = service->GetExtensionByWebExtent(site_instance->site()); | 437 extension = service->GetExtensionByWebExtent(site_instance->site()); |
| 438 if (!extension) | 438 if (!extension) |
| 439 return; | 439 return; |
| 440 | 440 |
| 441 service->process_map()->Insert( | 441 service->process_map()->Insert(extension->id(), |
| 442 extension->id(), site_instance->GetProcess()->GetID()); | 442 site_instance->GetProcess()->GetID(), |
| 443 site_instance->id()); |
| 443 BrowserThread::PostTask( | 444 BrowserThread::PostTask( |
| 444 BrowserThread::IO, FROM_HERE, | 445 BrowserThread::IO, FROM_HERE, |
| 445 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, | 446 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, |
| 446 profile->GetExtensionInfoMap(), | 447 profile->GetExtensionInfoMap(), |
| 447 extension->id(), | 448 extension->id(), |
| 448 site_instance->GetProcess()->GetID())); | 449 site_instance->GetProcess()->GetID(), |
| 450 site_instance->id())); |
| 449 } | 451 } |
| 450 | 452 |
| 451 void ChromeContentBrowserClient::SiteInstanceDeleting( | 453 void ChromeContentBrowserClient::SiteInstanceDeleting( |
| 452 SiteInstance* site_instance) { | 454 SiteInstance* site_instance) { |
| 453 if (!site_instance->HasProcess()) | 455 if (!site_instance->HasProcess()) |
| 454 return; | 456 return; |
| 455 | 457 |
| 456 Profile* profile = Profile::FromBrowserContext( | 458 Profile* profile = Profile::FromBrowserContext( |
| 457 site_instance->browsing_instance()->browser_context()); | 459 site_instance->browsing_instance()->browser_context()); |
| 458 ExtensionService* service = profile->GetExtensionService(); | 460 ExtensionService* service = profile->GetExtensionService(); |
| 459 if (!service) | 461 if (!service) |
| 460 return; | 462 return; |
| 461 | 463 |
| 462 const Extension* extension = | 464 const Extension* extension = |
| 463 service->GetExtensionByURL(site_instance->site()); | 465 service->GetExtensionByURL(site_instance->site()); |
| 464 if (!extension) | 466 if (!extension) |
| 465 extension = service->GetExtensionByWebExtent(site_instance->site()); | 467 extension = service->GetExtensionByWebExtent(site_instance->site()); |
| 466 if (!extension) | 468 if (!extension) |
| 467 return; | 469 return; |
| 468 | 470 |
| 469 service->process_map()->Remove( | 471 service->process_map()->Remove(extension->id(), |
| 470 extension->id(), site_instance->GetProcess()->GetID()); | 472 site_instance->GetProcess()->GetID(), |
| 473 site_instance->id()); |
| 471 BrowserThread::PostTask( | 474 BrowserThread::PostTask( |
| 472 BrowserThread::IO, FROM_HERE, | 475 BrowserThread::IO, FROM_HERE, |
| 473 base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, | 476 base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, |
| 474 profile->GetExtensionInfoMap(), | 477 profile->GetExtensionInfoMap(), |
| 475 extension->id(), | 478 extension->id(), |
| 476 site_instance->GetProcess()->GetID())); | 479 site_instance->GetProcess()->GetID(), |
| 480 site_instance->id())); |
| 477 } | 481 } |
| 478 | 482 |
| 479 bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( | 483 bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( |
| 480 const GURL& current_url, | 484 const GURL& current_url, |
| 481 const GURL& new_url) { | 485 const GURL& new_url) { |
| 482 if (current_url.is_empty()) { | 486 if (current_url.is_empty()) { |
| 483 // Always choose a new process when navigating to extension URLs. The | 487 // Always choose a new process when navigating to extension URLs. The |
| 484 // process grouping logic will combine all of a given extension's pages | 488 // process grouping logic will combine all of a given extension's pages |
| 485 // into the same process. | 489 // into the same process. |
| 486 if (new_url.SchemeIs(chrome::kExtensionScheme)) | 490 if (new_url.SchemeIs(chrome::kExtensionScheme)) |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 #if defined(USE_NSS) | 1115 #if defined(USE_NSS) |
| 1112 crypto::CryptoModuleBlockingPasswordDelegate* | 1116 crypto::CryptoModuleBlockingPasswordDelegate* |
| 1113 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 1117 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 1114 const GURL& url) { | 1118 const GURL& url) { |
| 1115 return browser::NewCryptoModuleBlockingDialogDelegate( | 1119 return browser::NewCryptoModuleBlockingDialogDelegate( |
| 1116 browser::kCryptoModulePasswordKeygen, url.host()); | 1120 browser::kCryptoModulePasswordKeygen, url.host()); |
| 1117 } | 1121 } |
| 1118 #endif | 1122 #endif |
| 1119 | 1123 |
| 1120 } // namespace chrome | 1124 } // namespace chrome |
| OLD | NEW |