[email protected] | d977f9c | 2011-03-14 16:10:26 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 7 | #include "base/command_line.h" |
| 8 | #include "chrome/app/breakpad_mac.h" |
[email protected] | b8148ac | 2011-07-13 22:03:25 | [diff] [blame] | 9 | #include "chrome/browser/browser_about_handler.h" |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 10 | #include "chrome/browser/browser_process.h" |
[email protected] | 3b8f7e3 | 2011-07-13 11:52:23 | [diff] [blame] | 11 | #include "chrome/browser/browsing_data_remover.h" |
[email protected] | 763ec4ca | 2011-04-29 15:48:12 | [diff] [blame] | 12 | #include "chrome/browser/character_encoding.h" |
[email protected] | 6f08af8 | 2011-09-15 01:19:03 | [diff] [blame] | 13 | #include "chrome/browser/chrome_benchmarking_message_filter.h" |
[email protected] | 97e6c4c | 2011-05-18 16:08:51 | [diff] [blame] | 14 | #include "chrome/browser/chrome_plugin_message_filter.h" |
[email protected] | 317f96c9 | 2011-05-31 06:53:41 | [diff] [blame] | 15 | #include "chrome/browser/chrome_quota_permission_context.h" |
[email protected] | 5327dfb | 2011-05-03 17:50:36 | [diff] [blame] | 16 | #include "chrome/browser/chrome_worker_message_filter.h" |
[email protected] | a217679 | 2011-05-08 19:30:49 | [diff] [blame] | 17 | #include "chrome/browser/content_settings/host_content_settings_map.h" |
[email protected] | 8093a54 | 2011-05-13 07:29:32 | [diff] [blame] | 18 | #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
[email protected] | e1d16eb9 | 2011-08-18 23:19:32 | [diff] [blame] | 19 | #include "chrome/browser/download/download_util.h" |
[email protected] | 941623e | 2011-06-07 23:06:04 | [diff] [blame] | 20 | #include "chrome/browser/extensions/extension_info_map.h" |
[email protected] | f364d139 | 2011-04-08 21:03:10 | [diff] [blame] | 21 | #include "chrome/browser/extensions/extension_message_handler.h" |
[email protected] | d977f9c | 2011-03-14 16:10:26 | [diff] [blame] | 22 | #include "chrome/browser/extensions/extension_service.h" |
[email protected] | b8148ac | 2011-07-13 22:03:25 | [diff] [blame] | 23 | #include "chrome/browser/extensions/extension_web_ui.h" |
[email protected] | 32538d9 | 2011-08-25 00:09:23 | [diff] [blame] | 24 | #include "chrome/browser/geolocation/chrome_access_token_store.h" |
[email protected] | 763ec4ca | 2011-04-29 15:48:12 | [diff] [blame] | 25 | #include "chrome/browser/google/google_util.h" |
[email protected] | ae6e991 | 2011-07-27 01:18:28 | [diff] [blame] | 26 | #include "chrome/browser/net/chrome_net_log.h" |
[email protected] | 941623e | 2011-06-07 23:06:04 | [diff] [blame] | 27 | #include "chrome/browser/notifications/desktop_notification_service.h" |
| 28 | #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
[email protected] | 0609b17f | 2011-05-31 20:13:42 | [diff] [blame] | 29 | #include "chrome/browser/platform_util.h" |
[email protected] | 763ec4ca | 2011-04-29 15:48:12 | [diff] [blame] | 30 | #include "chrome/browser/prefs/pref_service.h" |
[email protected] | f9034cf | 2011-07-21 12:43:41 | [diff] [blame] | 31 | #include "chrome/browser/prerender/prerender_manager.h" |
[email protected] | 3085c50 | 2011-10-05 17:50:50 | [diff] [blame] | 32 | #include "chrome/browser/prerender/prerender_manager_factory.h" |
[email protected] | f9034cf | 2011-07-21 12:43:41 | [diff] [blame] | 33 | #include "chrome/browser/prerender/prerender_tracker.h" |
[email protected] | 05fcf98 | 2011-04-19 00:44:14 | [diff] [blame] | 34 | #include "chrome/browser/printing/printing_message_filter.h" |
| 35 | #include "chrome/browser/profiles/profile.h" |
[email protected] | 8093a54 | 2011-05-13 07:29:32 | [diff] [blame] | 36 | #include "chrome/browser/profiles/profile_io_data.h" |
[email protected] | 05fcf98 | 2011-04-19 00:44:14 | [diff] [blame] | 37 | #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
[email protected] | 53a0afa | 2011-04-28 02:09:33 | [diff] [blame] | 38 | #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h" |
[email protected] | 05fcf98 | 2011-04-19 00:44:14 | [diff] [blame] | 39 | #include "chrome/browser/search_engines/search_provider_install_state_message_filter.h" |
[email protected] | 3bc0b56 | 2011-08-24 23:51:04 | [diff] [blame] | 40 | #include "chrome/browser/speech/chrome_speech_input_manager.h" |
[email protected] | 8ec7126 | 2011-07-28 08:12:46 | [diff] [blame] | 41 | #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
[email protected] | 8ec2647 | 2011-06-06 16:52:45 | [diff] [blame] | 42 | #include "chrome/browser/ssl/ssl_add_cert_handler.h" |
[email protected] | 848dd04 | 2011-06-04 18:24:03 | [diff] [blame] | 43 | #include "chrome/browser/ssl/ssl_blocking_page.h" |
[email protected] | 181a95ee | 2011-07-12 19:26:36 | [diff] [blame] | 44 | #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" |
[email protected] | 8ec2647 | 2011-06-06 16:52:45 | [diff] [blame] | 45 | #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
| 46 | #include "chrome/browser/tab_contents/tab_util.h" |
| 47 | #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
[email protected] | 1fd1a50 | 2011-03-30 16:55:56 | [diff] [blame] | 48 | #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 49 | #include "chrome/common/child_process_logging.h" |
[email protected] | 4a65826d | 2011-08-25 16:04:01 | [diff] [blame] | 50 | #include "chrome/common/chrome_constants.h" |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 51 | #include "chrome/common/chrome_switches.h" |
[email protected] | 941623e | 2011-06-07 23:06:04 | [diff] [blame] | 52 | #include "chrome/common/extensions/extension.h" |
[email protected] | f193379 | 2011-06-14 00:49:34 | [diff] [blame] | 53 | #include "chrome/common/logging_chrome.h" |
[email protected] | 763ec4ca | 2011-04-29 15:48:12 | [diff] [blame] | 54 | #include "chrome/common/pref_names.h" |
[email protected] | 3e69bc8 | 2011-05-26 23:22:38 | [diff] [blame] | 55 | #include "chrome/common/render_messages.h" |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 56 | #include "chrome/common/url_constants.h" |
[email protected] | b8148ac | 2011-07-13 22:03:25 | [diff] [blame] | 57 | #include "content/browser/browser_url_handler.h" |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 58 | #include "content/browser/browsing_instance.h" |
[email protected] | 97e6c4c | 2011-05-18 16:08:51 | [diff] [blame] | 59 | #include "content/browser/plugin_process_host.h" |
[email protected] | 05fcf98 | 2011-04-19 00:44:14 | [diff] [blame] | 60 | #include "content/browser/renderer_host/browser_render_process_host.h" |
[email protected] | d977f9c | 2011-03-14 16:10:26 | [diff] [blame] | 61 | #include "content/browser/renderer_host/render_view_host.h" |
[email protected] | a217679 | 2011-05-08 19:30:49 | [diff] [blame] | 62 | #include "content/browser/resource_context.h" |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 63 | #include "content/browser/site_instance.h" |
[email protected] | f9034cf | 2011-07-21 12:43:41 | [diff] [blame] | 64 | #include "content/browser/ssl/ssl_cert_error_handler.h" |
[email protected] | 8ec2647 | 2011-06-06 16:52:45 | [diff] [blame] | 65 | #include "content/browser/ssl/ssl_client_auth_handler.h" |
[email protected] | 763ec4ca | 2011-04-29 15:48:12 | [diff] [blame] | 66 | #include "content/browser/tab_contents/tab_contents.h" |
[email protected] | 74313b4 | 2011-08-24 16:51:32 | [diff] [blame] | 67 | #include "content/browser/tab_contents/tab_contents_view.h" |
[email protected] | 5327dfb | 2011-05-03 17:50:36 | [diff] [blame] | 68 | #include "content/browser/worker_host/worker_process_host.h" |
[email protected] | 941623e | 2011-06-07 23:06:04 | [diff] [blame] | 69 | #include "content/common/desktop_notification_messages.h" |
[email protected] | c9b6eb6 | 2011-10-18 20:49:39 | [diff] [blame] | 70 | #include "grit/generated_resources.h" |
[email protected] | 29b25d09 | 2011-06-29 20:57:34 | [diff] [blame] | 71 | #include "grit/ui_resources.h" |
[email protected] | ed24fad | 2011-05-10 22:44:01 | [diff] [blame] | 72 | #include "net/base/cookie_monster.h" |
| 73 | #include "net/base/cookie_options.h" |
[email protected] | c9b6eb6 | 2011-10-18 20:49:39 | [diff] [blame] | 74 | #include "ui/base/l10n/l10n_util.h" |
[email protected] | ac55e29 | 2011-06-24 05:16:08 | [diff] [blame] | 75 | #include "ui/base/resource/resource_bundle.h" |
[email protected] | d977f9c | 2011-03-14 16:10:26 | [diff] [blame] | 76 | |
[email protected] | 5778d50 | 2011-10-13 17:13:21 | [diff] [blame] | 77 | #if defined(OS_CHROMEOS) |
| 78 | #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
| 79 | #elif defined(USE_AURA) |
[email protected] | 199fc7a | 2011-09-28 22:45:38 | [diff] [blame] | 80 | #include "chrome/browser/chrome_browser_main_aura.h" |
| 81 | #elif defined(OS_WIN) |
| 82 | #include "chrome/browser/chrome_browser_main_win.h" |
| 83 | #elif defined(OS_MACOSX) |
| 84 | #include "chrome/browser/chrome_browser_main_mac.h" |
[email protected] | 199fc7a | 2011-09-28 22:45:38 | [diff] [blame] | 85 | #elif defined(OS_LINUX) |
| 86 | #include "chrome/browser/chrome_browser_main_gtk.h" |
| 87 | #endif |
| 88 | |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 89 | #if defined(OS_LINUX) |
| 90 | #include "base/linux_util.h" |
| 91 | #include "chrome/browser/crash_handler_host_linux.h" |
[email protected] | 1fd5302c | 2011-05-28 04:06:43 | [diff] [blame] | 92 | #endif |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 93 | |
[email protected] | 080f34f | 2011-09-20 05:39:26 | [diff] [blame] | 94 | #if defined(TOOLKIT_VIEWS) |
[email protected] | 74313b4 | 2011-08-24 16:51:32 | [diff] [blame] | 95 | #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" |
| 96 | #elif defined(OS_LINUX) |
| 97 | #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" |
| 98 | #elif defined(OS_MACOSX) |
| 99 | #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
[email protected] | 74313b4 | 2011-08-24 16:51:32 | [diff] [blame] | 100 | #endif |
| 101 | |
[email protected] | 37a72af | 2011-06-13 05:42:01 | [diff] [blame] | 102 | #if defined(USE_NSS) |
| 103 | #include "chrome/browser/ui/crypto_module_password_dialog.h" |
| 104 | #endif |
| 105 | |
[email protected] | b45937e | 2011-10-07 19:49:17 | [diff] [blame] | 106 | |
| 107 | #if defined(USE_AURA) || defined(TOUCH_UI) |
| 108 | #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
| 109 | #elif defined(OS_WIN) |
| 110 | #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
| 111 | #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 112 | #elif defined(OS_LINUX) |
| 113 | #include "content/browser/renderer_host/render_widget_host_view_gtk.h" |
| 114 | #elif defined(OS_MACOSX) |
| 115 | #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 116 | #endif |
| 117 | |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 118 | namespace { |
| 119 | |
[email protected] | b8148ac | 2011-07-13 22:03:25 | [diff] [blame] | 120 | // Handles rewriting Web UI URLs. |
[email protected] | 8d3132f6 | 2011-10-12 07:13:42 | [diff] [blame] | 121 | bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 122 | if (!ChromeWebUIFactory::GetInstance()->UseWebUIForURL(browser_context, *url)) |
[email protected] | b8148ac | 2011-07-13 22:03:25 | [diff] [blame] | 123 | return false; |
| 124 | |
| 125 | // Special case the new tab page. In older versions of Chrome, the new tab |
| 126 | // page was hosted at chrome-internal:<blah>. This might be in people's saved |
| 127 | // sessions or bookmarks, so we say any URL with that scheme triggers the new |
| 128 | // tab page. |
| 129 | if (url->SchemeIs(chrome::kChromeInternalScheme)) { |
| 130 | // Rewrite it with the proper new tab URL. |
| 131 | *url = GURL(chrome::kChromeUINewTabURL); |
| 132 | } |
| 133 | |
| 134 | return true; |
| 135 | } |
| 136 | |
[email protected] | 8d3132f6 | 2011-10-12 07:13:42 | [diff] [blame] | 137 | // Used by the GetPrivilegeRequiredByUrl() and GetProcessPrivilege() functions |
| 138 | // below. Extension, and isolated apps require different privileges to be |
| 139 | // granted to their RenderProcessHosts. This classification allows us to make |
| 140 | // sure URLs are served by hosts with the right set of privileges. |
| 141 | enum RenderProcessHostPrivilege { |
| 142 | PRIV_NORMAL, |
| 143 | PRIV_EXTENSION, |
| 144 | PRIV_ISOLATED, |
| 145 | }; |
| 146 | |
| 147 | RenderProcessHostPrivilege GetPrivilegeRequiredByUrl( |
| 148 | const GURL& url, |
| 149 | ExtensionService* service) { |
| 150 | // Default to a normal renderer cause it is lower privileged. This should only |
| 151 | // occur if the URL on a site instance is either malformed, or uninitialized. |
| 152 | // If it is malformed, then there is no need for better privileges anyways. |
| 153 | // If it is uninitialized, but eventually settles on being an a scheme other |
| 154 | // than normal webrenderer, the navigation logic will correct us out of band |
| 155 | // anyways. |
| 156 | if (!url.is_valid()) |
| 157 | return PRIV_NORMAL; |
| 158 | |
| 159 | if (url.SchemeIs(chrome::kExtensionScheme)) { |
| 160 | const Extension* extension = service->GetExtensionByURL(url); |
| 161 | if (extension && extension->is_storage_isolated()) { |
| 162 | return PRIV_ISOLATED; |
| 163 | } |
| 164 | |
| 165 | return PRIV_EXTENSION; |
| 166 | } |
| 167 | |
| 168 | return PRIV_NORMAL; |
| 169 | } |
| 170 | |
| 171 | RenderProcessHostPrivilege GetProcessPrivilege( |
| 172 | RenderProcessHost* process_host, |
| 173 | ExtensionProcessManager* extension_process_manager) { |
[email protected] | 676f6ab | 2011-10-19 20:23:21 | [diff] [blame] | 174 | if (!extension_process_manager->IsExtensionProcess(process_host->id())) |
| 175 | return PRIV_NORMAL; |
| 176 | |
| 177 | std::set<const Extension*> extensions_for_process( |
| 178 | extension_process_manager->GetExtensionsForProcess(process_host->id())); |
| 179 | for (std::set<const Extension*>::iterator iter = |
| 180 | extensions_for_process.begin(); |
| 181 | iter != extensions_for_process.end(); ++iter) { |
| 182 | if ((*iter)->is_storage_isolated()) |
[email protected] | 8d3132f6 | 2011-10-12 07:13:42 | [diff] [blame] | 183 | return PRIV_ISOLATED; |
[email protected] | 8d3132f6 | 2011-10-12 07:13:42 | [diff] [blame] | 184 | } |
| 185 | |
[email protected] | 676f6ab | 2011-10-19 20:23:21 | [diff] [blame] | 186 | return PRIV_EXTENSION; |
[email protected] | 8d3132f6 | 2011-10-12 07:13:42 | [diff] [blame] | 187 | } |
| 188 | |
[email protected] | 9dbfff1 | 2011-07-01 19:37:07 | [diff] [blame] | 189 | } // namespace |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 190 | |
[email protected] | d977f9c | 2011-03-14 16:10:26 | [diff] [blame] | 191 | namespace chrome { |
| 192 | |
[email protected] | f967b72 | 2011-09-07 00:58:04 | [diff] [blame] | 193 | content::BrowserMainParts* ChromeContentBrowserClient::CreateBrowserMainParts( |
| 194 | const MainFunctionParams& parameters) { |
[email protected] | 5778d50 | 2011-10-13 17:13:21 | [diff] [blame] | 195 | #if defined(OS_CHROMEOS) |
| 196 | return new ChromeBrowserMainPartsChromeos(parameters); |
| 197 | #elif defined(USE_AURA) |
[email protected] | 199fc7a | 2011-09-28 22:45:38 | [diff] [blame] | 198 | return new ChromeBrowserMainPartsAura(parameters); |
| 199 | #elif defined(OS_WIN) |
[email protected] | e6b5bc2 | 2011-09-08 22:01:56 | [diff] [blame] | 200 | return new ChromeBrowserMainPartsWin(parameters); |
[email protected] | f967b72 | 2011-09-07 00:58:04 | [diff] [blame] | 201 | #elif defined(OS_MACOSX) |
[email protected] | 46c83b6 | 2011-09-08 22:09:04 | [diff] [blame] | 202 | return new ChromeBrowserMainPartsMac(parameters); |
[email protected] | f967b72 | 2011-09-07 00:58:04 | [diff] [blame] | 203 | #elif defined(OS_LINUX) |
[email protected] | e6b5bc2 | 2011-09-08 22:01:56 | [diff] [blame] | 204 | return new ChromeBrowserMainPartsGtk(parameters); |
[email protected] | f967b72 | 2011-09-07 00:58:04 | [diff] [blame] | 205 | #else |
| 206 | return NULL; |
| 207 | #endif |
| 208 | } |
| 209 | |
[email protected] | b45937e | 2011-10-07 19:49:17 | [diff] [blame] | 210 | RenderWidgetHostView* ChromeContentBrowserClient::CreateViewForWidget( |
| 211 | RenderWidgetHost* widget) { |
| 212 | #if defined(USE_AURA) || defined(TOUCH_UI) |
| 213 | return new RenderWidgetHostViewViews(widget); |
| 214 | #elif defined(OS_WIN) |
| 215 | if (views::Widget::IsPureViews()) |
| 216 | return new RenderWidgetHostViewViews(widget); |
| 217 | return new RenderWidgetHostViewWin(widget); |
| 218 | #elif defined(OS_LINUX) |
| 219 | return new RenderWidgetHostViewGtk(widget); |
| 220 | #elif defined(OS_MACOSX) |
| 221 | return render_widget_host_view_mac::CreateRenderWidgetHostView(widget); |
| 222 | #else |
| 223 | #error Need to create your platform ViewForWidget here. |
| 224 | #endif |
| 225 | } |
| 226 | |
[email protected] | 74313b4 | 2011-08-24 16:51:32 | [diff] [blame] | 227 | TabContentsView* ChromeContentBrowserClient::CreateTabContentsView( |
| 228 | TabContents* tab_contents) { |
[email protected] | 080f34f | 2011-09-20 05:39:26 | [diff] [blame] | 229 | #if defined(TOOLKIT_VIEWS) |
[email protected] | 74313b4 | 2011-08-24 16:51:32 | [diff] [blame] | 230 | return new TabContentsViewViews(tab_contents); |
| 231 | #elif defined(OS_LINUX) |
| 232 | return new TabContentsViewGtk(tab_contents); |
| 233 | #elif defined(OS_MACOSX) |
| 234 | return tab_contents_view_mac::CreateTabContentsView(tab_contents); |
[email protected] | 74313b4 | 2011-08-24 16:51:32 | [diff] [blame] | 235 | #else |
| 236 | #error Need to create your platform TabContentsView here. |
| 237 | #endif |
| 238 | } |
| 239 | |
[email protected] | f364d139 | 2011-04-08 21:03:10 | [diff] [blame] | 240 | void ChromeContentBrowserClient::RenderViewHostCreated( |
| 241 | RenderViewHost* render_view_host) { |
[email protected] | 67372ecf | 2011-09-10 01:30:46 | [diff] [blame] | 242 | |
| 243 | SiteInstance* site_instance = render_view_host->site_instance(); |
| 244 | Profile* profile = Profile::FromBrowserContext( |
| 245 | site_instance->browsing_instance()->browser_context()); |
| 246 | |
| 247 | new ChromeRenderViewHostObserver(render_view_host, |
| 248 | profile->GetNetworkPredictor()); |
[email protected] | f364d139 | 2011-04-08 21:03:10 | [diff] [blame] | 249 | new ExtensionMessageHandler(render_view_host); |
[email protected] | d977f9c | 2011-03-14 16:10:26 | [diff] [blame] | 250 | } |
| 251 | |
[email protected] | 05fcf98 | 2011-04-19 00:44:14 | [diff] [blame] | 252 | void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( |
| 253 | BrowserRenderProcessHost* host) { |
[email protected] | c47cfd6 | 2011-04-29 21:27:02 | [diff] [blame] | 254 | int id = host->id(); |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 255 | Profile* profile = Profile::FromBrowserContext(host->browser_context()); |
[email protected] | 05fcf98 | 2011-04-19 00:44:14 | [diff] [blame] | 256 | host->channel()->AddFilter(new ChromeRenderMessageFilter( |
[email protected] | c47cfd6 | 2011-04-29 21:27:02 | [diff] [blame] | 257 | id, profile, profile->GetRequestContextForRenderProcess(id))); |
[email protected] | 05fcf98 | 2011-04-19 00:44:14 | [diff] [blame] | 258 | host->channel()->AddFilter(new PrintingMessageFilter()); |
| 259 | host->channel()->AddFilter( |
[email protected] | c47cfd6 | 2011-04-29 21:27:02 | [diff] [blame] | 260 | new SearchProviderInstallStateMessageFilter(id, profile)); |
| 261 | host->channel()->AddFilter(new SpellCheckMessageFilter(id)); |
[email protected] | 6f08af8 | 2011-09-15 01:19:03 | [diff] [blame] | 262 | host->channel()->AddFilter(new ChromeBenchmarkingMessageFilter( |
| 263 | id, profile, profile->GetRequestContextForRenderProcess(id))); |
[email protected] | 3e69bc8 | 2011-05-26 23:22:38 | [diff] [blame] | 264 | |
[email protected] | 2ccf45c | 2011-08-19 23:35:50 | [diff] [blame] | 265 | host->Send(new ChromeViewMsg_SetIsIncognitoProcess( |
| 266 | profile->IsOffTheRecord())); |
[email protected] | 05fcf98 | 2011-04-19 00:44:14 | [diff] [blame] | 267 | } |
| 268 | |
[email protected] | 97e6c4c | 2011-05-18 16:08:51 | [diff] [blame] | 269 | void ChromeContentBrowserClient::PluginProcessHostCreated( |
| 270 | PluginProcessHost* host) { |
| 271 | host->AddFilter(new ChromePluginMessageFilter(host)); |
| 272 | } |
| 273 | |
[email protected] | 5327dfb | 2011-05-03 17:50:36 | [diff] [blame] | 274 | void ChromeContentBrowserClient::WorkerProcessHostCreated( |
| 275 | WorkerProcessHost* host) { |
| 276 | host->AddFilter(new ChromeWorkerMessageFilter(host)); |
| 277 | } |
| 278 | |
[email protected] | 1fd1a50 | 2011-03-30 16:55:56 | [diff] [blame] | 279 | content::WebUIFactory* ChromeContentBrowserClient::GetWebUIFactory() { |
| 280 | return ChromeWebUIFactory::GetInstance(); |
| 281 | } |
| 282 | |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 283 | GURL ChromeContentBrowserClient::GetEffectiveURL( |
| 284 | content::BrowserContext* browser_context, const GURL& url) { |
| 285 | Profile* profile = Profile::FromBrowserContext(browser_context); |
[email protected] | 36fb2c7c | 2011-04-04 15:49:08 | [diff] [blame] | 286 | // Get the effective URL for the given actual URL. If the URL is part of an |
| 287 | // installed app, the effective URL is an extension URL with the ID of that |
| 288 | // extension as the host. This has the effect of grouping apps together in |
| 289 | // a common SiteInstance. |
| 290 | if (!profile || !profile->GetExtensionService()) |
| 291 | return url; |
| 292 | |
| 293 | const Extension* extension = |
| 294 | profile->GetExtensionService()->GetExtensionByWebExtent(url); |
| 295 | if (!extension) |
| 296 | return url; |
| 297 | |
| 298 | // If the URL is part of an extension's web extent, convert it to an |
| 299 | // extension URL. |
| 300 | return extension->GetResourceURL(url.path()); |
| 301 | } |
| 302 | |
[email protected] | 056ad2a | 2011-07-12 02:13:55 | [diff] [blame] | 303 | bool ChromeContentBrowserClient::ShouldUseProcessPerSite( |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 304 | content::BrowserContext* browser_context, const GURL& effective_url) { |
[email protected] | 056ad2a | 2011-07-12 02:13:55 | [diff] [blame] | 305 | // Non-extension URLs should generally use process-per-site-instance. |
| 306 | // Because we expect to use the effective URL, hosted apps URLs should have |
| 307 | // an extension scheme by now. |
| 308 | if (!effective_url.SchemeIs(chrome::kExtensionScheme)) |
| 309 | return false; |
| 310 | |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 311 | Profile* profile = Profile::FromBrowserContext(browser_context); |
[email protected] | 056ad2a | 2011-07-12 02:13:55 | [diff] [blame] | 312 | if (!profile || !profile->GetExtensionService()) |
| 313 | return false; |
| 314 | |
| 315 | const Extension* extension = |
| 316 | profile->GetExtensionService()->GetExtensionByURL(effective_url); |
| 317 | if (!extension) |
| 318 | return false; |
| 319 | |
| 320 | // If the URL is part of a hosted app that does not have the background |
| 321 | // permission, we want to give each instance its own process to improve |
| 322 | // responsiveness. |
| 323 | if (extension->GetType() == Extension::TYPE_HOSTED_APP && |
| 324 | !extension->HasAPIPermission(ExtensionAPIPermission::kBackground)) |
| 325 | return false; |
| 326 | |
| 327 | // Hosted apps that have the background permission must use process per site, |
| 328 | // since all instances can make synchronous calls to the background window. |
| 329 | // Other extensions should use process per site as well. |
| 330 | return true; |
| 331 | } |
| 332 | |
[email protected] | 0f012df8 | 2011-05-19 14:15:29 | [diff] [blame] | 333 | bool ChromeContentBrowserClient::IsURLSameAsAnySiteInstance(const GURL& url) { |
[email protected] | 89f550b | 2011-06-08 18:34:03 | [diff] [blame] | 334 | return url == GURL(chrome::kChromeUICrashURL) || |
| 335 | url == GURL(chrome::kChromeUIKillURL) || |
| 336 | url == GURL(chrome::kChromeUIHangURL) || |
| 337 | url == GURL(chrome::kChromeUIShorthangURL); |
[email protected] | 0f012df8 | 2011-05-19 14:15:29 | [diff] [blame] | 338 | } |
| 339 | |
[email protected] | 2a5221b | 2011-09-27 23:07:31 | [diff] [blame] | 340 | bool ChromeContentBrowserClient::IsSuitableHost( |
| 341 | RenderProcessHost* process_host, |
| 342 | const GURL& site_url) { |
| 343 | Profile* profile = |
| 344 | Profile::FromBrowserContext(process_host->browser_context()); |
| 345 | ExtensionProcessManager* extension_process_manager = |
| 346 | profile->GetExtensionProcessManager(); |
[email protected] | 8d3132f6 | 2011-10-12 07:13:42 | [diff] [blame] | 347 | ExtensionService* service = profile->GetExtensionService(); |
[email protected] | 2a5221b | 2011-09-27 23:07:31 | [diff] [blame] | 348 | |
[email protected] | 8d3132f6 | 2011-10-12 07:13:42 | [diff] [blame] | 349 | // These may be NULL during tests. In that case, just assume any site can |
| 350 | // share any host. |
| 351 | if (!extension_process_manager || !service) |
[email protected] | 2a5221b | 2011-09-27 23:07:31 | [diff] [blame] | 352 | return true; |
| 353 | |
[email protected] | 8d3132f6 | 2011-10-12 07:13:42 | [diff] [blame] | 354 | return GetProcessPrivilege(process_host, extension_process_manager) == |
| 355 | GetPrivilegeRequiredByUrl(site_url, service); |
[email protected] | 2a5221b | 2011-09-27 23:07:31 | [diff] [blame] | 356 | } |
| 357 | |
[email protected] | e3daf3c | 2011-10-05 21:17:08 | [diff] [blame] | 358 | bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( |
| 359 | const GURL& current_url, |
| 360 | const GURL& new_url) { |
| 361 | if (current_url.is_empty()) { |
| 362 | // Always choose a new process when navigating to extension URLs. The |
| 363 | // process grouping logic will combine all of a given extension's pages |
| 364 | // into the same process. |
| 365 | if (new_url.SchemeIs(chrome::kExtensionScheme)) |
| 366 | return true; |
| 367 | |
| 368 | return false; |
| 369 | } |
| 370 | |
| 371 | // Also, we must switch if one is an extension and the other is not the exact |
| 372 | // same extension. |
| 373 | if (current_url.SchemeIs(chrome::kExtensionScheme) || |
| 374 | new_url.SchemeIs(chrome::kExtensionScheme)) { |
| 375 | if (current_url.GetOrigin() != new_url.GetOrigin()) |
| 376 | return true; |
| 377 | } |
| 378 | |
| 379 | return false; |
| 380 | } |
| 381 | |
[email protected] | 763ec4ca | 2011-04-29 15:48:12 | [diff] [blame] | 382 | std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName( |
| 383 | const std::string& alias_name) { |
| 384 | return CharacterEncoding::GetCanonicalEncodingNameByAliasName(alias_name); |
| 385 | } |
| 386 | |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 387 | void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( |
| 388 | CommandLine* command_line, int child_process_id) { |
| 389 | #if defined(USE_LINUX_BREAKPAD) |
| 390 | if (IsCrashReporterEnabled()) { |
| 391 | command_line->AppendSwitchASCII(switches::kEnableCrashReporter, |
| 392 | child_process_logging::GetClientId() + "," + base::GetLinuxDistro()); |
| 393 | } |
| 394 | #elif defined(OS_MACOSX) |
| 395 | if (IsCrashReporterEnabled()) { |
| 396 | command_line->AppendSwitchASCII(switches::kEnableCrashReporter, |
| 397 | child_process_logging::GetClientId()); |
| 398 | } |
| 399 | #endif // OS_MACOSX |
| 400 | |
[email protected] | f193379 | 2011-06-14 00:49:34 | [diff] [blame] | 401 | if (logging::DialogsAreSuppressed()) |
| 402 | command_line->AppendSwitch(switches::kNoErrorDialogs); |
| 403 | |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 404 | std::string process_type = |
| 405 | command_line->GetSwitchValueASCII(switches::kProcessType); |
[email protected] | 3cb054e6 | 2011-06-13 05:21:17 | [diff] [blame] | 406 | const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
[email protected] | 718eab6 | 2011-10-05 21:16:52 | [diff] [blame] | 407 | if (process_type == switches::kRendererProcess) { |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 408 | FilePath user_data_dir = |
| 409 | browser_command_line.GetSwitchValuePath(switches::kUserDataDir); |
| 410 | if (!user_data_dir.empty()) |
| 411 | command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
| 412 | #if defined(OS_CHROMEOS) |
| 413 | const std::string& login_profile = |
| 414 | browser_command_line.GetSwitchValueASCII(switches::kLoginProfile); |
| 415 | if (!login_profile.empty()) |
| 416 | command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile); |
| 417 | #endif |
| 418 | |
| 419 | RenderProcessHost* process = RenderProcessHost::FromID(child_process_id); |
| 420 | |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 421 | Profile* profile = Profile::FromBrowserContext(process->browser_context()); |
[email protected] | 718eab6 | 2011-10-05 21:16:52 | [diff] [blame] | 422 | |
| 423 | ExtensionProcessManager* extension_process_manager = |
| 424 | profile->GetExtensionProcessManager(); |
| 425 | if (extension_process_manager->IsExtensionProcess( |
| 426 | process->id())) { |
| 427 | command_line->AppendSwitch(switches::kExtensionProcess); |
| 428 | } |
| 429 | |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 430 | PrefService* prefs = profile->GetPrefs(); |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 431 | // Currently this pref is only registered if applied via a policy. |
| 432 | if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && |
| 433 | prefs->GetBoolean(prefs::kDisable3DAPIs)) { |
| 434 | // Turn this policy into a command line switch. |
| 435 | command_line->AppendSwitch(switches::kDisable3DAPIs); |
| 436 | } |
| 437 | |
| 438 | // Disable client-side phishing detection in the renderer if it is disabled |
[email protected] | 8c40da6 | 2011-07-13 22:58:46 | [diff] [blame] | 439 | // in the Profile preferences or the browser process. |
| 440 | if (!prefs->GetBoolean(prefs::kSafeBrowsingEnabled) || |
| 441 | !g_browser_process->safe_browsing_detection_service()) { |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 442 | command_line->AppendSwitch(switches::kDisableClientSidePhishingDetection); |
[email protected] | 8c40da6 | 2011-07-13 22:58:46 | [diff] [blame] | 443 | } |
[email protected] | 4287a3d | 2011-06-13 23:56:51 | [diff] [blame] | 444 | |
| 445 | static const char* const kSwitchNames[] = { |
| 446 | switches::kAllowHTTPBackgroundPage, |
| 447 | switches::kAllowScriptingGallery, |
| 448 | switches::kAppsCheckoutURL, |
| 449 | switches::kAppsGalleryURL, |
[email protected] | be9d9c8 | 2011-07-13 04:17:31 | [diff] [blame] | 450 | switches::kCloudPrintServiceURL, |
[email protected] | 4287a3d | 2011-06-13 23:56:51 | [diff] [blame] | 451 | switches::kDebugPrint, |
[email protected] | 4287a3d | 2011-06-13 23:56:51 | [diff] [blame] | 452 | switches::kDisablePrintPreview, |
[email protected] | 4287a3d | 2011-06-13 23:56:51 | [diff] [blame] | 453 | switches::kDomAutomationController, |
| 454 | switches::kDumpHistogramsOnExit, |
| 455 | switches::kEnableClickToPlay, |
| 456 | switches::kEnableCrxlessWebApps, |
| 457 | switches::kEnableExperimentalExtensionApis, |
| 458 | switches::kEnableInBrowserThumbnailing, |
| 459 | switches::kEnableIPCFuzzing, |
[email protected] | 06024c6 | 2011-10-20 20:57:12 | [diff] [blame^] | 460 | switches::kEnableLazyBackgroundPages, |
[email protected] | 4287a3d | 2011-06-13 23:56:51 | [diff] [blame] | 461 | switches::kEnableNaCl, |
[email protected] | 5714ee3 | 2011-08-18 01:51:24 | [diff] [blame] | 462 | switches::kEnablePrintPreview, |
[email protected] | 4287a3d | 2011-06-13 23:56:51 | [diff] [blame] | 463 | switches::kEnableSearchProviderApiV2, |
| 464 | switches::kEnableWatchdog, |
| 465 | switches::kExperimentalSpellcheckerFeatures, |
| 466 | switches::kMemoryProfiling, |
| 467 | switches::kMessageLoopHistogrammer, |
[email protected] | 2a6bb0b1 | 2011-10-05 19:18:04 | [diff] [blame] | 468 | switches::kNoRunningInsecureContent, |
[email protected] | 4287a3d | 2011-06-13 23:56:51 | [diff] [blame] | 469 | switches::kPpapiFlashArgs, |
| 470 | switches::kPpapiFlashInProcess, |
| 471 | switches::kPpapiFlashPath, |
| 472 | switches::kPpapiFlashVersion, |
| 473 | switches::kProfilingAtStart, |
| 474 | switches::kProfilingFile, |
| 475 | switches::kProfilingFlush, |
[email protected] | 4287a3d | 2011-06-13 23:56:51 | [diff] [blame] | 476 | switches::kSilentDumpOnDCHECK, |
[email protected] | 6f08af8 | 2011-09-15 01:19:03 | [diff] [blame] | 477 | switches::kEnableBenchmarking, |
[email protected] | 4287a3d | 2011-06-13 23:56:51 | [diff] [blame] | 478 | }; |
| 479 | |
| 480 | command_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
| 481 | arraysize(kSwitchNames)); |
[email protected] | 3cb054e6 | 2011-06-13 05:21:17 | [diff] [blame] | 482 | } else if (process_type == switches::kUtilityProcess) { |
| 483 | if (browser_command_line.HasSwitch( |
| 484 | switches::kEnableExperimentalExtensionApis)) { |
| 485 | command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 486 | } |
[email protected] | 4287a3d | 2011-06-13 23:56:51 | [diff] [blame] | 487 | } else if (process_type == switches::kPluginProcess) { |
| 488 | static const char* const kSwitchNames[] = { |
| 489 | #if defined(OS_CHROMEOS) |
| 490 | switches::kLoginProfile, |
| 491 | #endif |
| 492 | switches::kMemoryProfiling, |
| 493 | switches::kSilentDumpOnDCHECK, |
| 494 | switches::kUserDataDir, |
| 495 | }; |
| 496 | |
| 497 | command_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
| 498 | arraysize(kSwitchNames)); |
| 499 | } else if (process_type == switches::kZygoteProcess) { |
| 500 | static const char* const kSwitchNames[] = { |
[email protected] | 4287a3d | 2011-06-13 23:56:51 | [diff] [blame] | 501 | switches::kUserDataDir, // Make logs go to the right file. |
| 502 | // Load (in-process) Pepper plugins in-process in the zygote pre-sandbox. |
| 503 | switches::kPpapiFlashInProcess, |
| 504 | switches::kPpapiFlashPath, |
| 505 | switches::kPpapiFlashVersion, |
| 506 | }; |
| 507 | |
| 508 | command_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
| 509 | arraysize(kSwitchNames)); |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 510 | } |
[email protected] | 6f08af8 | 2011-09-15 01:19:03 | [diff] [blame] | 511 | |
| 512 | // The command line switch kEnableBenchmarking needs to be specified along |
| 513 | // with the kEnableStatsTable switch to ensure that the stats table global |
| 514 | // is initialized correctly. |
| 515 | if (command_line->HasSwitch(switches::kEnableBenchmarking)) |
| 516 | DCHECK(command_line->HasSwitch(switches::kEnableStatsTable)); |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 517 | } |
| 518 | |
| 519 | std::string ChromeContentBrowserClient::GetApplicationLocale() { |
| 520 | return g_browser_process->GetApplicationLocale(); |
| 521 | } |
| 522 | |
[email protected] | b5cca98 | 2011-05-26 04:42:08 | [diff] [blame] | 523 | std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 524 | Profile* profile = Profile::FromBrowserContext(tab->browser_context()); |
| 525 | return profile->GetPrefs()->GetString(prefs::kAcceptLanguages); |
[email protected] | b5cca98 | 2011-05-26 04:42:08 | [diff] [blame] | 526 | } |
| 527 | |
[email protected] | ac55e29 | 2011-06-24 05:16:08 | [diff] [blame] | 528 | SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() { |
| 529 | ResourceBundle &rb = ResourceBundle::GetSharedInstance(); |
[email protected] | 2cc6a929 | 2011-10-13 21:41:01 | [diff] [blame] | 530 | #if defined(TOUCH_UI) |
| 531 | // In touch builds, we want large default favicons for the tabstrip, but in |
| 532 | // other places (such as bookmark, manage search engines, homepage) we assume |
| 533 | // default favicons are 16x16. |
| 534 | return rb.GetBitmapNamed(IDR_DEFAULT_LARGE_FAVICON); |
| 535 | #else |
[email protected] | ac55e29 | 2011-06-24 05:16:08 | [diff] [blame] | 536 | return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); |
[email protected] | 2cc6a929 | 2011-10-13 21:41:01 | [diff] [blame] | 537 | #endif |
[email protected] | ac55e29 | 2011-06-24 05:16:08 | [diff] [blame] | 538 | } |
| 539 | |
[email protected] | a217679 | 2011-05-08 19:30:49 | [diff] [blame] | 540 | bool ChromeContentBrowserClient::AllowAppCache( |
[email protected] | 5b52ad4 | 2011-05-26 14:26:09 | [diff] [blame] | 541 | const GURL& manifest_url, |
[email protected] | 0a60884 | 2011-09-08 10:55:19 | [diff] [blame] | 542 | const GURL& first_party, |
[email protected] | 5b52ad4 | 2011-05-26 14:26:09 | [diff] [blame] | 543 | const content::ResourceContext& context) { |
[email protected] | 8093a54 | 2011-05-13 07:29:32 | [diff] [blame] | 544 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 545 | ProfileIOData* io_data = |
| 546 | reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
[email protected] | efa5521 | 2011-05-13 16:19:38 | [diff] [blame] | 547 | ContentSetting setting = io_data->GetHostContentSettingsMap()-> |
[email protected] | 0a60884 | 2011-09-08 10:55:19 | [diff] [blame] | 548 | GetCookieContentSetting(manifest_url, first_party, true); |
[email protected] | a217679 | 2011-05-08 19:30:49 | [diff] [blame] | 549 | DCHECK(setting != CONTENT_SETTING_DEFAULT); |
| 550 | return setting != CONTENT_SETTING_BLOCK; |
| 551 | } |
| 552 | |
[email protected] | ed24fad | 2011-05-10 22:44:01 | [diff] [blame] | 553 | bool ChromeContentBrowserClient::AllowGetCookie( |
| 554 | const GURL& url, |
| 555 | const GURL& first_party, |
| 556 | const net::CookieList& cookie_list, |
| 557 | const content::ResourceContext& context, |
| 558 | int render_process_id, |
| 559 | int render_view_id) { |
| 560 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 8093a54 | 2011-05-13 07:29:32 | [diff] [blame] | 561 | ProfileIOData* io_data = |
| 562 | reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
[email protected] | 5b52ad4 | 2011-05-26 14:26:09 | [diff] [blame] | 563 | ContentSetting setting = io_data->GetHostContentSettingsMap()-> |
| 564 | GetCookieContentSetting(url, first_party, false); |
| 565 | bool allow = setting == CONTENT_SETTING_ALLOW || |
| 566 | setting == CONTENT_SETTING_SESSION_ONLY; |
[email protected] | ed24fad | 2011-05-10 22:44:01 | [diff] [blame] | 567 | |
[email protected] | 8093a54 | 2011-05-13 07:29:32 | [diff] [blame] | 568 | BrowserThread::PostTask( |
| 569 | BrowserThread::UI, FROM_HERE, |
| 570 | NewRunnableFunction( |
| 571 | &TabSpecificContentSettings::CookiesRead, |
| 572 | render_process_id, render_view_id, url, cookie_list, !allow)); |
[email protected] | ed24fad | 2011-05-10 22:44:01 | [diff] [blame] | 573 | return allow; |
| 574 | } |
| 575 | |
| 576 | bool ChromeContentBrowserClient::AllowSetCookie( |
| 577 | const GURL& url, |
| 578 | const GURL& first_party, |
| 579 | const std::string& cookie_line, |
| 580 | const content::ResourceContext& context, |
| 581 | int render_process_id, |
| 582 | int render_view_id, |
| 583 | net::CookieOptions* options) { |
| 584 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
[email protected] | 8093a54 | 2011-05-13 07:29:32 | [diff] [blame] | 585 | ProfileIOData* io_data = |
| 586 | reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
[email protected] | 5b52ad4 | 2011-05-26 14:26:09 | [diff] [blame] | 587 | ContentSetting setting = io_data->GetHostContentSettingsMap()-> |
| 588 | GetCookieContentSetting(url, first_party, true); |
[email protected] | ed24fad | 2011-05-10 22:44:01 | [diff] [blame] | 589 | |
[email protected] | 5b52ad4 | 2011-05-26 14:26:09 | [diff] [blame] | 590 | if (setting == CONTENT_SETTING_SESSION_ONLY) |
| 591 | options->set_force_session(); |
[email protected] | ed24fad | 2011-05-10 22:44:01 | [diff] [blame] | 592 | |
[email protected] | 5b52ad4 | 2011-05-26 14:26:09 | [diff] [blame] | 593 | bool allow = setting == CONTENT_SETTING_ALLOW || |
| 594 | setting == CONTENT_SETTING_SESSION_ONLY; |
[email protected] | ed24fad | 2011-05-10 22:44:01 | [diff] [blame] | 595 | |
[email protected] | 8093a54 | 2011-05-13 07:29:32 | [diff] [blame] | 596 | BrowserThread::PostTask( |
| 597 | BrowserThread::UI, FROM_HERE, |
| 598 | NewRunnableFunction( |
| 599 | &TabSpecificContentSettings::CookieChanged, |
| 600 | render_process_id, render_view_id, url, cookie_line, *options, |
| 601 | !allow)); |
[email protected] | ed24fad | 2011-05-10 22:44:01 | [diff] [blame] | 602 | return allow; |
| 603 | } |
| 604 | |
[email protected] | d5a1916 | 2011-06-30 18:51:54 | [diff] [blame] | 605 | bool ChromeContentBrowserClient::AllowSaveLocalState( |
| 606 | const content::ResourceContext& context) { |
| 607 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 608 | ProfileIOData* io_data = |
| 609 | reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 610 | return !io_data->clear_local_state_on_exit()->GetValue(); |
| 611 | } |
| 612 | |
[email protected] | 6133f92 | 2011-07-01 21:34:34 | [diff] [blame] | 613 | net::URLRequestContext* |
| 614 | ChromeContentBrowserClient::OverrideRequestContextForURL( |
| 615 | const GURL& url, const content::ResourceContext& context) { |
| 616 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 617 | if (url.SchemeIs(chrome::kExtensionScheme)) { |
| 618 | ProfileIOData* io_data = |
| 619 | reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 620 | return io_data->extensions_request_context(); |
| 621 | } |
| 622 | |
| 623 | return NULL; |
| 624 | } |
| 625 | |
[email protected] | 317f96c9 | 2011-05-31 06:53:41 | [diff] [blame] | 626 | QuotaPermissionContext* |
| 627 | ChromeContentBrowserClient::CreateQuotaPermissionContext() { |
| 628 | return new ChromeQuotaPermissionContext(); |
| 629 | } |
| 630 | |
[email protected] | a0ce328 | 2011-08-19 20:49:52 | [diff] [blame] | 631 | void ChromeContentBrowserClient::OpenItem(const FilePath& path) { |
[email protected] | 0609b17f | 2011-05-31 20:13:42 | [diff] [blame] | 632 | // On Mac, this call needs to be done on the UI thread. On other platforms, |
| 633 | // do it on the FILE thread so we don't slow down UI. |
| 634 | #if defined(OS_MACOSX) |
| 635 | platform_util::OpenItem(path); |
| 636 | #else |
| 637 | BrowserThread::PostTask( |
| 638 | BrowserThread::FILE, FROM_HERE, |
| 639 | NewRunnableFunction(&platform_util::OpenItem, path)); |
| 640 | #endif |
| 641 | } |
| 642 | |
[email protected] | a0ce328 | 2011-08-19 20:49:52 | [diff] [blame] | 643 | void ChromeContentBrowserClient::ShowItemInFolder(const FilePath& path) { |
| 644 | #if defined(OS_MACOSX) |
| 645 | // Mac needs to run this operation on the UI thread. |
| 646 | platform_util::ShowItemInFolder(path); |
| 647 | #else |
| 648 | BrowserThread::PostTask( |
| 649 | BrowserThread::FILE, FROM_HERE, |
| 650 | NewRunnableFunction(&platform_util::ShowItemInFolder, path)); |
| 651 | #endif |
| 652 | } |
| 653 | |
[email protected] | 848dd04 | 2011-06-04 18:24:03 | [diff] [blame] | 654 | void ChromeContentBrowserClient::AllowCertificateError( |
| 655 | SSLCertErrorHandler* handler, |
| 656 | bool overridable, |
[email protected] | 8a27abf | 2011-09-30 21:59:58 | [diff] [blame] | 657 | const base::Callback<void(SSLCertErrorHandler*, bool)>& callback) { |
[email protected] | f9034cf | 2011-07-21 12:43:41 | [diff] [blame] | 658 | // If the tab is being prerendered, cancel the prerender and the request. |
| 659 | TabContents* tab = tab_util::GetTabContentsByID( |
| 660 | handler->render_process_host_id(), |
| 661 | handler->tab_contents_id()); |
| 662 | if (!tab) { |
| 663 | NOTREACHED(); |
| 664 | return; |
| 665 | } |
| 666 | prerender::PrerenderManager* prerender_manager = |
[email protected] | 3085c50 | 2011-10-05 17:50:50 | [diff] [blame] | 667 | prerender::PrerenderManagerFactory::GetForProfile( |
| 668 | Profile::FromBrowserContext(tab->browser_context())); |
[email protected] | f9034cf | 2011-07-21 12:43:41 | [diff] [blame] | 669 | if (prerender_manager && prerender_manager->IsTabContentsPrerendering(tab)) { |
| 670 | if (prerender_manager->prerender_tracker()->TryCancel( |
| 671 | handler->render_process_host_id(), |
| 672 | handler->tab_contents_id(), |
| 673 | prerender::FINAL_STATUS_SSL_ERROR)) { |
| 674 | handler->CancelRequest(); |
| 675 | return; |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | // Otherwise, display an SSL blocking page. |
[email protected] | 848dd04 | 2011-06-04 18:24:03 | [diff] [blame] | 680 | SSLBlockingPage* blocking_page = new SSLBlockingPage( |
| 681 | handler, overridable, callback); |
| 682 | blocking_page->Show(); |
| 683 | } |
| 684 | |
[email protected] | c99c442e | 2011-08-24 11:37:30 | [diff] [blame] | 685 | void ChromeContentBrowserClient::SelectClientCertificate( |
[email protected] | 8ec2647 | 2011-06-06 16:52:45 | [diff] [blame] | 686 | int render_process_id, |
| 687 | int render_view_id, |
| 688 | SSLClientAuthHandler* handler) { |
| 689 | TabContents* tab = tab_util::GetTabContentsByID( |
| 690 | render_process_id, render_view_id); |
| 691 | if (!tab) { |
| 692 | NOTREACHED(); |
| 693 | return; |
| 694 | } |
| 695 | |
| 696 | TabContentsWrapper* wrapper = |
| 697 | TabContentsWrapper::GetCurrentWrapperForContents(tab); |
[email protected] | c99c442e | 2011-08-24 11:37:30 | [diff] [blame] | 698 | wrapper->ssl_helper()->SelectClientCertificate(handler); |
[email protected] | 8ec2647 | 2011-06-06 16:52:45 | [diff] [blame] | 699 | } |
| 700 | |
| 701 | void ChromeContentBrowserClient::AddNewCertificate( |
| 702 | net::URLRequest* request, |
| 703 | net::X509Certificate* cert, |
| 704 | int render_process_id, |
| 705 | int render_view_id) { |
| 706 | // The handler will run the UI and delete itself when it's finished. |
| 707 | new SSLAddCertHandler(request, cert, render_process_id, render_view_id); |
| 708 | } |
| 709 | |
[email protected] | 941623e | 2011-06-07 23:06:04 | [diff] [blame] | 710 | void ChromeContentBrowserClient::RequestDesktopNotificationPermission( |
| 711 | const GURL& source_origin, |
| 712 | int callback_context, |
| 713 | int render_process_id, |
| 714 | int render_view_id) { |
| 715 | RenderViewHost* rvh = RenderViewHost::FromID( |
| 716 | render_process_id, render_view_id); |
| 717 | if (!rvh) { |
| 718 | NOTREACHED(); |
| 719 | return; |
| 720 | } |
| 721 | |
| 722 | RenderProcessHost* process = rvh->process(); |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 723 | Profile* profile = Profile::FromBrowserContext(process->browser_context()); |
[email protected] | 941623e | 2011-06-07 23:06:04 | [diff] [blame] | 724 | DesktopNotificationService* service = |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 725 | DesktopNotificationServiceFactory::GetForProfile(profile); |
[email protected] | 941623e | 2011-06-07 23:06:04 | [diff] [blame] | 726 | service->RequestPermission( |
| 727 | source_origin, render_process_id, render_view_id, callback_context, |
| 728 | tab_util::GetTabContentsByID(render_process_id, render_view_id)); |
| 729 | } |
| 730 | |
| 731 | WebKit::WebNotificationPresenter::Permission |
| 732 | ChromeContentBrowserClient::CheckDesktopNotificationPermission( |
| 733 | const GURL& source_url, |
| 734 | const content::ResourceContext& context) { |
| 735 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 736 | ProfileIOData* io_data = |
| 737 | reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 738 | |
| 739 | const Extension* extension = |
| 740 | io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); |
| 741 | if (extension && |
[email protected] | 0d3e4a2 | 2011-06-23 19:02:52 | [diff] [blame] | 742 | extension->HasAPIPermission(ExtensionAPIPermission::kNotification)) { |
[email protected] | 941623e | 2011-06-07 23:06:04 | [diff] [blame] | 743 | return WebKit::WebNotificationPresenter::PermissionAllowed; |
| 744 | } |
| 745 | |
| 746 | // Fall back to the regular notification preferences, which works on an |
| 747 | // origin basis. |
| 748 | return io_data->GetNotificationService() ? |
| 749 | io_data->GetNotificationService()->HasPermission(source_url.GetOrigin()) : |
| 750 | WebKit::WebNotificationPresenter::PermissionNotAllowed; |
| 751 | } |
| 752 | |
| 753 | void ChromeContentBrowserClient::ShowDesktopNotification( |
| 754 | const DesktopNotificationHostMsg_Show_Params& params, |
| 755 | int render_process_id, |
| 756 | int render_view_id, |
| 757 | bool worker) { |
| 758 | RenderViewHost* rvh = RenderViewHost::FromID( |
| 759 | render_process_id, render_view_id); |
| 760 | if (!rvh) { |
| 761 | NOTREACHED(); |
| 762 | return; |
| 763 | } |
| 764 | |
| 765 | RenderProcessHost* process = rvh->process(); |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 766 | Profile* profile = Profile::FromBrowserContext(process->browser_context()); |
[email protected] | 941623e | 2011-06-07 23:06:04 | [diff] [blame] | 767 | DesktopNotificationService* service = |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 768 | DesktopNotificationServiceFactory::GetForProfile(profile); |
[email protected] | 941623e | 2011-06-07 23:06:04 | [diff] [blame] | 769 | service->ShowDesktopNotification( |
| 770 | params, render_process_id, render_view_id, |
| 771 | worker ? DesktopNotificationService::WorkerNotification : |
| 772 | DesktopNotificationService::PageNotification); |
| 773 | } |
| 774 | |
| 775 | void ChromeContentBrowserClient::CancelDesktopNotification( |
| 776 | int render_process_id, |
| 777 | int render_view_id, |
| 778 | int notification_id) { |
| 779 | RenderViewHost* rvh = RenderViewHost::FromID( |
| 780 | render_process_id, render_view_id); |
| 781 | if (!rvh) { |
| 782 | NOTREACHED(); |
| 783 | return; |
| 784 | } |
| 785 | |
| 786 | RenderProcessHost* process = rvh->process(); |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 787 | Profile* profile = Profile::FromBrowserContext(process->browser_context()); |
[email protected] | 941623e | 2011-06-07 23:06:04 | [diff] [blame] | 788 | DesktopNotificationService* service = |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 789 | DesktopNotificationServiceFactory::GetForProfile(profile); |
[email protected] | 941623e | 2011-06-07 23:06:04 | [diff] [blame] | 790 | service->CancelDesktopNotification( |
| 791 | render_process_id, render_view_id, notification_id); |
| 792 | } |
| 793 | |
[email protected] | 9f3fba5 | 2011-06-08 20:37:19 | [diff] [blame] | 794 | bool ChromeContentBrowserClient::CanCreateWindow( |
| 795 | const GURL& source_url, |
| 796 | WindowContainerType container_type, |
| 797 | const content::ResourceContext& context) { |
| 798 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 799 | // If the opener is trying to create a background window but doesn't have |
| 800 | // the appropriate permission, fail the attempt. |
| 801 | if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { |
| 802 | ProfileIOData* io_data = |
| 803 | reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 804 | const Extension* extension = |
| 805 | io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url); |
| 806 | return (extension && |
[email protected] | 0d3e4a2 | 2011-06-23 19:02:52 | [diff] [blame] | 807 | extension->HasAPIPermission(ExtensionAPIPermission::kBackground)); |
[email protected] | 9f3fba5 | 2011-06-08 20:37:19 | [diff] [blame] | 808 | } |
| 809 | return true; |
| 810 | } |
| 811 | |
| 812 | std::string ChromeContentBrowserClient::GetWorkerProcessTitle( |
| 813 | const GURL& url, const content::ResourceContext& context) { |
| 814 | DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 815 | // Check if it's an extension-created worker, in which case we want to use |
| 816 | // the name of the extension. |
| 817 | ProfileIOData* io_data = |
| 818 | reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL)); |
| 819 | const Extension* extension = |
| 820 | io_data->GetExtensionInfoMap()->extensions().GetByID(url.host()); |
| 821 | return extension ? extension->name() : std::string(); |
| 822 | } |
| 823 | |
[email protected] | 3cb054e6 | 2011-06-13 05:21:17 | [diff] [blame] | 824 | ResourceDispatcherHost* |
| 825 | ChromeContentBrowserClient::GetResourceDispatcherHost() { |
| 826 | return g_browser_process->resource_dispatcher_host(); |
| 827 | } |
| 828 | |
| 829 | ui::Clipboard* ChromeContentBrowserClient::GetClipboard() { |
| 830 | return g_browser_process->clipboard(); |
| 831 | } |
| 832 | |
[email protected] | 8f6a3b85 | 2011-07-19 16:48:56 | [diff] [blame] | 833 | MHTMLGenerationManager* |
| 834 | ChromeContentBrowserClient::GetMHTMLGenerationManager() { |
| 835 | return g_browser_process->mhtml_generation_manager(); |
| 836 | } |
| 837 | |
[email protected] | dce50276 | 2011-07-20 08:53:49 | [diff] [blame] | 838 | DevToolsManager* ChromeContentBrowserClient::GetDevToolsManager() { |
| 839 | return g_browser_process->devtools_manager(); |
| 840 | } |
| 841 | |
[email protected] | ae6e991 | 2011-07-27 01:18:28 | [diff] [blame] | 842 | net::NetLog* ChromeContentBrowserClient::GetNetLog() { |
| 843 | return g_browser_process->net_log(); |
| 844 | } |
| 845 | |
[email protected] | 3bc0b56 | 2011-08-24 23:51:04 | [diff] [blame] | 846 | speech_input::SpeechInputManager* |
| 847 | ChromeContentBrowserClient::GetSpeechInputManager() { |
| 848 | return speech_input::ChromeSpeechInputManager::GetInstance(); |
| 849 | } |
| 850 | |
[email protected] | 32538d9 | 2011-08-25 00:09:23 | [diff] [blame] | 851 | AccessTokenStore* ChromeContentBrowserClient::CreateAccessTokenStore() { |
| 852 | return new ChromeAccessTokenStore(); |
| 853 | } |
| 854 | |
[email protected] | dbae6b0 | 2011-06-29 23:51:41 | [diff] [blame] | 855 | bool ChromeContentBrowserClient::IsFastShutdownPossible() { |
| 856 | const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 857 | return !browser_command_line.HasSwitch(switches::kChromeFrame); |
| 858 | } |
| 859 | |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 860 | WebPreferences ChromeContentBrowserClient::GetWebkitPrefs( |
| 861 | content::BrowserContext* browser_context, bool is_web_ui) { |
| 862 | return RenderViewHostDelegateHelper::GetWebkitPrefs(browser_context, |
| 863 | is_web_ui); |
[email protected] | 181a95ee | 2011-07-12 19:26:36 | [diff] [blame] | 864 | } |
| 865 | |
| 866 | void ChromeContentBrowserClient::UpdateInspectorSetting( |
| 867 | RenderViewHost* rvh, const std::string& key, const std::string& value) { |
| 868 | RenderViewHostDelegateHelper::UpdateInspectorSetting( |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 869 | rvh->process()->browser_context(), key, value); |
[email protected] | 181a95ee | 2011-07-12 19:26:36 | [diff] [blame] | 870 | } |
| 871 | |
| 872 | void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) { |
| 873 | RenderViewHostDelegateHelper::ClearInspectorSettings( |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 874 | rvh->process()->browser_context()); |
[email protected] | 181a95ee | 2011-07-12 19:26:36 | [diff] [blame] | 875 | } |
| 876 | |
[email protected] | b8148ac | 2011-07-13 22:03:25 | [diff] [blame] | 877 | void ChromeContentBrowserClient::BrowserURLHandlerCreated( |
| 878 | BrowserURLHandler* handler) { |
| 879 | // Add the default URL handlers. |
| 880 | handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, |
| 881 | BrowserURLHandler::null_handler()); |
| 882 | handler->AddHandlerPair(BrowserURLHandler::null_handler(), |
| 883 | &ExtensionWebUI::HandleChromeURLOverrideReverse); |
| 884 | |
| 885 | // about: |
| 886 | handler->AddHandlerPair(&WillHandleBrowserAboutURL, |
| 887 | BrowserURLHandler::null_handler()); |
| 888 | // chrome: & friends. |
| 889 | handler->AddHandlerPair(&HandleWebUI, |
| 890 | BrowserURLHandler::null_handler()); |
| 891 | } |
| 892 | |
| 893 | void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) { |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 894 | Profile* profile = Profile::FromBrowserContext( |
| 895 | rvh->site_instance()->GetProcess()->browser_context()); |
[email protected] | b8148ac | 2011-07-13 22:03:25 | [diff] [blame] | 896 | BrowsingDataRemover* remover = new BrowsingDataRemover(profile, |
| 897 | BrowsingDataRemover::EVERYTHING, |
| 898 | base::Time()); |
| 899 | remover->Remove(BrowsingDataRemover::REMOVE_CACHE); |
| 900 | // BrowsingDataRemover takes care of deleting itself when done. |
| 901 | } |
| 902 | |
| 903 | void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) { |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 904 | Profile* profile = Profile::FromBrowserContext( |
| 905 | rvh->site_instance()->GetProcess()->browser_context()); |
[email protected] | b8148ac | 2011-07-13 22:03:25 | [diff] [blame] | 906 | BrowsingDataRemover* remover = new BrowsingDataRemover(profile, |
| 907 | BrowsingDataRemover::EVERYTHING, |
| 908 | base::Time()); |
[email protected] | dceaa91 | 2011-09-06 17:17:23 | [diff] [blame] | 909 | int remove_mask = BrowsingDataRemover::REMOVE_SITE_DATA; |
[email protected] | b8148ac | 2011-07-13 22:03:25 | [diff] [blame] | 910 | remover->Remove(remove_mask); |
| 911 | // BrowsingDataRemover takes care of deleting itself when done. |
| 912 | } |
| 913 | |
[email protected] | e1d16eb9 | 2011-08-18 23:19:32 | [diff] [blame] | 914 | FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() { |
| 915 | return download_util::GetDefaultDownloadDirectory(); |
| 916 | } |
| 917 | |
[email protected] | c9b6eb6 | 2011-10-18 20:49:39 | [diff] [blame] | 918 | std::string ChromeContentBrowserClient::GetDefaultDownloadName() { |
| 919 | return l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME); |
| 920 | } |
| 921 | |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 922 | #if defined(OS_LINUX) |
| 923 | int ChromeContentBrowserClient::GetCrashSignalFD( |
[email protected] | 718eab6 | 2011-10-05 21:16:52 | [diff] [blame] | 924 | const CommandLine& command_line) { |
| 925 | if (command_line.HasSwitch(switches::kExtensionProcess)) { |
[email protected] | 9dbfff1 | 2011-07-01 19:37:07 | [diff] [blame] | 926 | ExtensionCrashHandlerHostLinux* crash_handler = |
| 927 | ExtensionCrashHandlerHostLinux::GetInstance(); |
| 928 | return crash_handler->GetDeathSignalSocket(); |
| 929 | } |
| 930 | |
[email protected] | 718eab6 | 2011-10-05 21:16:52 | [diff] [blame] | 931 | std::string process_type = |
| 932 | command_line.GetSwitchValueASCII(switches::kProcessType); |
| 933 | |
| 934 | if (process_type == switches::kRendererProcess) |
| 935 | return RendererCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
| 936 | |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 937 | if (process_type == switches::kPluginProcess) |
| 938 | return PluginCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
| 939 | |
| 940 | if (process_type == switches::kPpapiPluginProcess) |
| 941 | return PpapiCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
| 942 | |
| 943 | if (process_type == switches::kGpuProcess) |
| 944 | return GpuCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
| 945 | |
| 946 | return -1; |
| 947 | } |
[email protected] | 9dbfff1 | 2011-07-01 19:37:07 | [diff] [blame] | 948 | #endif // defined(OS_LINUX) |
[email protected] | b80f6843 | 2011-05-02 17:22:30 | [diff] [blame] | 949 | |
[email protected] | 4a65826d | 2011-08-25 16:04:01 | [diff] [blame] | 950 | #if defined(OS_WIN) |
| 951 | const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { |
| 952 | return chrome::kBrowserResourcesDll; |
| 953 | } |
| 954 | #endif |
| 955 | |
[email protected] | 37a72af | 2011-06-13 05:42:01 | [diff] [blame] | 956 | #if defined(USE_NSS) |
| 957 | crypto::CryptoModuleBlockingPasswordDelegate* |
| 958 | ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 959 | const GURL& url) { |
| 960 | return browser::NewCryptoModuleBlockingDialogDelegate( |
| 961 | browser::kCryptoModulePasswordKeygen, url.host()); |
| 962 | } |
| 963 | #endif |
| 964 | |
[email protected] | d977f9c | 2011-03-14 16:10:26 | [diff] [blame] | 965 | } // namespace chrome |