| 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 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/threading/sequenced_worker_pool.h" | 18 #include "base/threading/sequenced_worker_pool.h" |
| 19 #include "chrome/app/breakpad_mac.h" | 19 #include "chrome/app/breakpad_mac.h" |
| 20 #include "chrome/browser/adview/adview_guest.h" |
| 20 #include "chrome/browser/app_mode/app_mode_utils.h" | 21 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 21 #include "chrome/browser/browser_about_handler.h" | 22 #include "chrome/browser/browser_about_handler.h" |
| 22 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 24 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 24 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 25 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 25 #include "chrome/browser/character_encoding.h" | 26 #include "chrome/browser/character_encoding.h" |
| 26 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" | 27 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" |
| 27 #include "chrome/browser/chrome_quota_permission_context.h" | 28 #include "chrome/browser/chrome_quota_permission_context.h" |
| 28 #include "chrome/browser/content_settings/content_settings_utils.h" | 29 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 29 #include "chrome/browser/content_settings/cookie_settings.h" | 30 #include "chrome/browser/content_settings/cookie_settings.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 #include "chrome/browser/ssl/ssl_tab_helper.h" | 78 #include "chrome/browser/ssl/ssl_tab_helper.h" |
| 78 #include "chrome/browser/tab_contents/tab_util.h" | 79 #include "chrome/browser/tab_contents/tab_util.h" |
| 79 #include "chrome/browser/toolkit_extra_parts.h" | 80 #include "chrome/browser/toolkit_extra_parts.h" |
| 80 #include "chrome/browser/ui/chrome_select_file_policy.h" | 81 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 81 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 82 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
| 82 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" | 83 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" |
| 83 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 84 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
| 84 #include "chrome/browser/user_style_sheet_watcher.h" | 85 #include "chrome/browser/user_style_sheet_watcher.h" |
| 85 #include "chrome/browser/user_style_sheet_watcher_factory.h" | 86 #include "chrome/browser/user_style_sheet_watcher_factory.h" |
| 86 #include "chrome/browser/validation_message_message_filter.h" | 87 #include "chrome/browser/validation_message_message_filter.h" |
| 88 #include "chrome/browser/webview/webview_constants.h" |
| 87 #include "chrome/browser/webview/webview_guest.h" | 89 #include "chrome/browser/webview/webview_guest.h" |
| 88 #include "chrome/common/child_process_logging.h" | 90 #include "chrome/common/child_process_logging.h" |
| 89 #include "chrome/common/chrome_constants.h" | 91 #include "chrome/common/chrome_constants.h" |
| 90 #include "chrome/common/chrome_paths.h" | 92 #include "chrome/common/chrome_paths.h" |
| 91 #include "chrome/common/chrome_process_type.h" | 93 #include "chrome/common/chrome_process_type.h" |
| 92 #include "chrome/common/chrome_switches.h" | 94 #include "chrome/common/chrome_switches.h" |
| 93 #include "chrome/common/extensions/background_info.h" | 95 #include "chrome/common/extensions/background_info.h" |
| 94 #include "chrome/common/extensions/extension.h" | 96 #include "chrome/common/extensions/extension.h" |
| 95 #include "chrome/common/extensions/extension_process_policy.h" | 97 #include "chrome/common/extensions/extension_process_policy.h" |
| 96 #include "chrome/common/extensions/extension_set.h" | 98 #include "chrome/common/extensions/extension_set.h" |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 embedder_web_contents->GetBrowserContext()); | 705 embedder_web_contents->GetBrowserContext()); |
| 704 ExtensionService* service = | 706 ExtensionService* service = |
| 705 extensions::ExtensionSystem::Get(profile)->extension_service(); | 707 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 706 if (!service) | 708 if (!service) |
| 707 return; | 709 return; |
| 708 const GURL& url = embedder_web_contents->GetSiteInstance()->GetSiteURL(); | 710 const GURL& url = embedder_web_contents->GetSiteInstance()->GetSiteURL(); |
| 709 const Extension* extension = service->extensions()-> | 711 const Extension* extension = service->extensions()-> |
| 710 GetExtensionOrAppByURL(ExtensionURLInfo(url)); | 712 GetExtensionOrAppByURL(ExtensionURLInfo(url)); |
| 711 if (!extension) | 713 if (!extension) |
| 712 return; | 714 return; |
| 713 new WebViewGuest(guest_web_contents, | 715 |
| 714 embedder_web_contents, | 716 std::string api_type; |
| 715 extension->id(), | 717 extra_params.GetString(webview::kAttributeApi, &api_type); |
| 716 browser_plugin_instance_id, | 718 |
| 717 extra_params); | 719 // WebViewGuest and AdViewGuest's lifetimes iare tied to their associated |
| 720 // guest WebContents' lifetime. When the guest WebContents is destroyed, so is |
| 721 // the attached WebViewGuest or AdViewGuest. |
| 722 if (api_type == "adview") { |
| 723 new AdViewGuest(guest_web_contents, |
| 724 embedder_web_contents, |
| 725 extension->id(), |
| 726 browser_plugin_instance_id, |
| 727 extra_params); |
| 728 } else if (api_type == "webview") { |
| 729 new WebViewGuest(guest_web_contents, |
| 730 embedder_web_contents, |
| 731 extension->id(), |
| 732 browser_plugin_instance_id, |
| 733 extra_params); |
| 734 } else { |
| 735 NOTREACHED(); |
| 736 } |
| 718 } | 737 } |
| 719 | 738 |
| 720 void ChromeContentBrowserClient::RenderProcessHostCreated( | 739 void ChromeContentBrowserClient::RenderProcessHostCreated( |
| 721 content::RenderProcessHost* host) { | 740 content::RenderProcessHost* host) { |
| 722 int id = host->GetID(); | 741 int id = host->GetID(); |
| 723 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 742 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 724 net::URLRequestContextGetter* context = | 743 net::URLRequestContextGetter* context = |
| 725 profile->GetRequestContextForRenderProcess(id); | 744 profile->GetRequestContextForRenderProcess(id); |
| 726 | 745 |
| 727 host->GetChannel()->AddFilter(new ChromeRenderMessageFilter( | 746 host->GetChannel()->AddFilter(new ChromeRenderMessageFilter( |
| (...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2346 #if defined(USE_NSS) | 2365 #if defined(USE_NSS) |
| 2347 crypto::CryptoModuleBlockingPasswordDelegate* | 2366 crypto::CryptoModuleBlockingPasswordDelegate* |
| 2348 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 2367 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 2349 const GURL& url) { | 2368 const GURL& url) { |
| 2350 return chrome::NewCryptoModuleBlockingDialogDelegate( | 2369 return chrome::NewCryptoModuleBlockingDialogDelegate( |
| 2351 chrome::kCryptoModulePasswordKeygen, url.host()); | 2370 chrome::kCryptoModulePasswordKeygen, url.host()); |
| 2352 } | 2371 } |
| 2353 #endif | 2372 #endif |
| 2354 | 2373 |
| 2355 } // namespace chrome | 2374 } // namespace chrome |
| OLD | NEW |