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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "chrome/common/child_process_logging.h" | 59 #include "chrome/common/child_process_logging.h" |
60 #include "chrome/common/chrome_constants.h" | 60 #include "chrome/common/chrome_constants.h" |
61 #include "chrome/common/chrome_switches.h" | 61 #include "chrome/common/chrome_switches.h" |
62 #include "chrome/common/extensions/extension.h" | 62 #include "chrome/common/extensions/extension.h" |
63 #include "chrome/common/extensions/extension_set.h" | 63 #include "chrome/common/extensions/extension_set.h" |
64 #include "chrome/common/logging_chrome.h" | 64 #include "chrome/common/logging_chrome.h" |
65 #include "chrome/common/pref_names.h" | 65 #include "chrome/common/pref_names.h" |
66 #include "chrome/common/render_messages.h" | 66 #include "chrome/common/render_messages.h" |
67 #include "chrome/common/url_constants.h" | 67 #include "chrome/common/url_constants.h" |
68 #include "content/browser/browser_url_handler.h" | 68 #include "content/browser/browser_url_handler.h" |
69 #include "content/browser/browsing_instance.h" | |
70 #include "content/browser/child_process_security_policy.h" | 69 #include "content/browser/child_process_security_policy.h" |
71 #include "content/browser/gpu/gpu_data_manager.h" | 70 #include "content/browser/gpu/gpu_data_manager.h" |
72 #include "content/browser/gpu/gpu_process_host.h" | 71 #include "content/browser/gpu/gpu_process_host.h" |
73 #include "content/browser/plugin_process_host.h" | 72 #include "content/browser/plugin_process_host.h" |
74 #include "content/browser/renderer_host/render_view_host.h" | 73 #include "content/browser/renderer_host/render_view_host.h" |
75 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 74 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
76 #include "content/browser/resource_context.h" | 75 #include "content/browser/resource_context.h" |
77 #include "content/browser/site_instance.h" | 76 #include "content/browser/site_instance.h" |
78 #include "content/browser/ssl/ssl_cert_error_handler.h" | 77 #include "content/browser/ssl/ssl_cert_error_handler.h" |
79 #include "content/browser/ssl/ssl_client_auth_handler.h" | 78 #include "content/browser/ssl/ssl_client_auth_handler.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 #else | 318 #else |
320 #error Need to create your platform TabContentsView here. | 319 #error Need to create your platform TabContentsView here. |
321 #endif | 320 #endif |
322 } | 321 } |
323 | 322 |
324 void ChromeContentBrowserClient::RenderViewHostCreated( | 323 void ChromeContentBrowserClient::RenderViewHostCreated( |
325 RenderViewHost* render_view_host) { | 324 RenderViewHost* render_view_host) { |
326 | 325 |
327 SiteInstance* site_instance = render_view_host->site_instance(); | 326 SiteInstance* site_instance = render_view_host->site_instance(); |
328 Profile* profile = Profile::FromBrowserContext( | 327 Profile* profile = Profile::FromBrowserContext( |
329 site_instance->browsing_instance()->browser_context()); | 328 site_instance->GetBrowserContext()); |
330 | 329 |
331 new ChromeRenderViewHostObserver(render_view_host, | 330 new ChromeRenderViewHostObserver(render_view_host, |
332 profile->GetNetworkPredictor()); | 331 profile->GetNetworkPredictor()); |
333 new ExtensionMessageHandler(render_view_host); | 332 new ExtensionMessageHandler(render_view_host); |
334 } | 333 } |
335 | 334 |
336 void ChromeContentBrowserClient::RenderProcessHostCreated( | 335 void ChromeContentBrowserClient::RenderProcessHostCreated( |
337 content::RenderProcessHost* host) { | 336 content::RenderProcessHost* host) { |
338 int id = host->GetID(); | 337 int id = host->GetID(); |
339 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 338 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 // required by the site. | 480 // required by the site. |
482 return GetProcessPrivilege(process_host, process_map, service) == | 481 return GetProcessPrivilege(process_host, process_map, service) == |
483 privilege_required; | 482 privilege_required; |
484 } | 483 } |
485 | 484 |
486 void ChromeContentBrowserClient::SiteInstanceGotProcess( | 485 void ChromeContentBrowserClient::SiteInstanceGotProcess( |
487 SiteInstance* site_instance) { | 486 SiteInstance* site_instance) { |
488 CHECK(site_instance->HasProcess()); | 487 CHECK(site_instance->HasProcess()); |
489 | 488 |
490 Profile* profile = Profile::FromBrowserContext( | 489 Profile* profile = Profile::FromBrowserContext( |
491 site_instance->browsing_instance()->browser_context()); | 490 site_instance->GetBrowserContext()); |
492 ExtensionService* service = profile->GetExtensionService(); | 491 ExtensionService* service = profile->GetExtensionService(); |
493 if (!service) | 492 if (!service) |
494 return; | 493 return; |
495 | 494 |
496 const Extension* extension = | 495 const Extension* extension = |
497 service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo( | 496 service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo( |
498 site_instance->site())); | 497 site_instance->site())); |
499 if (!extension) | 498 if (!extension) |
500 return; | 499 return; |
501 | 500 |
502 service->process_map()->Insert(extension->id(), | 501 service->process_map()->Insert(extension->id(), |
503 site_instance->GetProcess()->GetID(), | 502 site_instance->GetProcess()->GetID(), |
504 site_instance->id()); | 503 site_instance->id()); |
505 BrowserThread::PostTask( | 504 BrowserThread::PostTask( |
506 BrowserThread::IO, FROM_HERE, | 505 BrowserThread::IO, FROM_HERE, |
507 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, | 506 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, |
508 profile->GetExtensionInfoMap(), | 507 profile->GetExtensionInfoMap(), |
509 extension->id(), | 508 extension->id(), |
510 site_instance->GetProcess()->GetID(), | 509 site_instance->GetProcess()->GetID(), |
511 site_instance->id())); | 510 site_instance->id())); |
512 } | 511 } |
513 | 512 |
514 void ChromeContentBrowserClient::SiteInstanceDeleting( | 513 void ChromeContentBrowserClient::SiteInstanceDeleting( |
515 SiteInstance* site_instance) { | 514 SiteInstance* site_instance) { |
516 if (!site_instance->HasProcess()) | 515 if (!site_instance->HasProcess()) |
517 return; | 516 return; |
518 | 517 |
519 Profile* profile = Profile::FromBrowserContext( | 518 Profile* profile = Profile::FromBrowserContext( |
520 site_instance->browsing_instance()->browser_context()); | 519 site_instance->GetBrowserContext()); |
521 ExtensionService* service = profile->GetExtensionService(); | 520 ExtensionService* service = profile->GetExtensionService(); |
522 if (!service) | 521 if (!service) |
523 return; | 522 return; |
524 | 523 |
525 const Extension* extension = | 524 const Extension* extension = |
526 service->extensions()->GetExtensionOrAppByURL( | 525 service->extensions()->GetExtensionOrAppByURL( |
527 ExtensionURLInfo(site_instance->site())); | 526 ExtensionURLInfo(site_instance->site())); |
528 if (!extension) | 527 if (!extension) |
529 return; | 528 return; |
530 | 529 |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 #if defined(USE_NSS) | 1471 #if defined(USE_NSS) |
1473 crypto::CryptoModuleBlockingPasswordDelegate* | 1472 crypto::CryptoModuleBlockingPasswordDelegate* |
1474 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 1473 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
1475 const GURL& url) { | 1474 const GURL& url) { |
1476 return browser::NewCryptoModuleBlockingDialogDelegate( | 1475 return browser::NewCryptoModuleBlockingDialogDelegate( |
1477 browser::kCryptoModulePasswordKeygen, url.host()); | 1476 browser::kCryptoModulePasswordKeygen, url.host()); |
1478 } | 1477 } |
1479 #endif | 1478 #endif |
1480 | 1479 |
1481 } // namespace chrome | 1480 } // namespace chrome |
OLD | NEW |