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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/app/breakpad_mac.h" | 8 #include "chrome/app/breakpad_mac.h" |
| 9 #include "chrome/browser/accessibility/browser_accessibility_state.h" |
9 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/character_encoding.h" | 11 #include "chrome/browser/character_encoding.h" |
11 #include "chrome/browser/chrome_plugin_message_filter.h" | 12 #include "chrome/browser/chrome_plugin_message_filter.h" |
12 #include "chrome/browser/chrome_quota_permission_context.h" | 13 #include "chrome/browser/chrome_quota_permission_context.h" |
13 #include "chrome/browser/chrome_worker_message_filter.h" | 14 #include "chrome/browser/chrome_worker_message_filter.h" |
14 #include "chrome/browser/content_settings/host_content_settings_map.h" | 15 #include "chrome/browser/content_settings/host_content_settings_map.h" |
15 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 16 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
16 #include "chrome/browser/debugger/devtools_handler.h" | 17 #include "chrome/browser/debugger/devtools_handler.h" |
17 #include "chrome/browser/extensions/extension_info_map.h" | 18 #include "chrome/browser/extensions/extension_info_map.h" |
18 #include "chrome/browser/extensions/extension_message_handler.h" | 19 #include "chrome/browser/extensions/extension_message_handler.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 129 } |
129 | 130 |
130 namespace chrome { | 131 namespace chrome { |
131 | 132 |
132 void ChromeContentBrowserClient::RenderViewHostCreated( | 133 void ChromeContentBrowserClient::RenderViewHostCreated( |
133 RenderViewHost* render_view_host) { | 134 RenderViewHost* render_view_host) { |
134 new ChromeRenderViewHostObserver(render_view_host); | 135 new ChromeRenderViewHostObserver(render_view_host); |
135 new DevToolsHandler(render_view_host); | 136 new DevToolsHandler(render_view_host); |
136 new ExtensionMessageHandler(render_view_host); | 137 new ExtensionMessageHandler(render_view_host); |
137 | 138 |
| 139 if (BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser()) |
| 140 render_view_host->EnableRendererAccessibility(); |
| 141 |
138 InitRenderViewHostForExtensions(render_view_host); | 142 InitRenderViewHostForExtensions(render_view_host); |
139 } | 143 } |
140 | 144 |
141 void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( | 145 void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( |
142 BrowserRenderProcessHost* host) { | 146 BrowserRenderProcessHost* host) { |
143 int id = host->id(); | 147 int id = host->id(); |
144 Profile* profile = host->profile(); | 148 Profile* profile = host->profile(); |
145 host->channel()->AddFilter(new ChromeRenderMessageFilter( | 149 host->channel()->AddFilter(new ChromeRenderMessageFilter( |
146 id, profile, profile->GetRequestContextForRenderProcess(id))); | 150 id, profile, profile->GetRequestContextForRenderProcess(id))); |
147 host->channel()->AddFilter(new PrintingMessageFilter()); | 151 host->channel()->AddFilter(new PrintingMessageFilter()); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && | 241 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && |
238 prefs->GetBoolean(prefs::kDisable3DAPIs)) { | 242 prefs->GetBoolean(prefs::kDisable3DAPIs)) { |
239 // Turn this policy into a command line switch. | 243 // Turn this policy into a command line switch. |
240 command_line->AppendSwitch(switches::kDisable3DAPIs); | 244 command_line->AppendSwitch(switches::kDisable3DAPIs); |
241 } | 245 } |
242 | 246 |
243 // Disable client-side phishing detection in the renderer if it is disabled | 247 // Disable client-side phishing detection in the renderer if it is disabled |
244 // in the browser process. | 248 // in the browser process. |
245 if (!g_browser_process->safe_browsing_detection_service()) | 249 if (!g_browser_process->safe_browsing_detection_service()) |
246 command_line->AppendSwitch(switches::kDisableClientSidePhishingDetection); | 250 command_line->AppendSwitch(switches::kDisableClientSidePhishingDetection); |
| 251 |
| 252 static const char* const kSwitchNames[] = { |
| 253 switches::kAllowHTTPBackgroundPage, |
| 254 switches::kAllowScriptingGallery, |
| 255 switches::kAppsCheckoutURL, |
| 256 switches::kAppsGalleryURL, |
| 257 switches::kDebugPrint, |
| 258 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) && !defined(OS_MACOSX) |
| 259 // Enabled by default in Google Chrome builds, except on CrOS. |
| 260 switches::kDisablePrintPreview, |
| 261 #else |
| 262 // Disabled by default in Chromium builds and on CrOS. |
| 263 switches::kEnablePrintPreview, |
| 264 #endif |
| 265 switches::kDomAutomationController, |
| 266 switches::kDumpHistogramsOnExit, |
| 267 switches::kEnableClickToPlay, |
| 268 switches::kEnableCrxlessWebApps, |
| 269 switches::kEnableExperimentalExtensionApis, |
| 270 switches::kEnableInBrowserThumbnailing, |
| 271 switches::kEnableIPCFuzzing, |
| 272 switches::kEnableNaCl, |
| 273 switches::kEnableRemoting, |
| 274 switches::kEnableResourceContentSettings, |
| 275 switches::kEnableSearchProviderApiV2, |
| 276 switches::kEnableWatchdog, |
| 277 switches::kExperimentalSpellcheckerFeatures, |
| 278 switches::kMemoryProfiling, |
| 279 switches::kMessageLoopHistogrammer, |
| 280 switches::kPpapiFlashArgs, |
| 281 switches::kPpapiFlashInProcess, |
| 282 switches::kPpapiFlashPath, |
| 283 switches::kPpapiFlashVersion, |
| 284 switches::kProfilingAtStart, |
| 285 switches::kProfilingFile, |
| 286 switches::kProfilingFlush, |
| 287 switches::kRemoteShellPort, |
| 288 switches::kSilentDumpOnDCHECK, |
| 289 }; |
| 290 |
| 291 command_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
| 292 arraysize(kSwitchNames)); |
247 } else if (process_type == switches::kUtilityProcess) { | 293 } else if (process_type == switches::kUtilityProcess) { |
248 if (browser_command_line.HasSwitch( | 294 if (browser_command_line.HasSwitch( |
249 switches::kEnableExperimentalExtensionApis)) { | 295 switches::kEnableExperimentalExtensionApis)) { |
250 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 296 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
251 } | 297 } |
| 298 } else if (process_type == switches::kPluginProcess) { |
| 299 static const char* const kSwitchNames[] = { |
| 300 #if defined(OS_CHROMEOS) |
| 301 switches::kLoginProfile, |
| 302 #endif |
| 303 switches::kMemoryProfiling, |
| 304 switches::kSilentDumpOnDCHECK, |
| 305 switches::kUserDataDir, |
| 306 }; |
| 307 |
| 308 command_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
| 309 arraysize(kSwitchNames)); |
| 310 } else if (process_type == switches::kZygoteProcess) { |
| 311 static const char* const kSwitchNames[] = { |
| 312 switches::kEnableRemoting, |
| 313 switches::kUserDataDir, // Make logs go to the right file. |
| 314 // Load (in-process) Pepper plugins in-process in the zygote pre-sandbox. |
| 315 switches::kPpapiFlashInProcess, |
| 316 switches::kPpapiFlashPath, |
| 317 switches::kPpapiFlashVersion, |
| 318 }; |
| 319 |
| 320 command_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
| 321 arraysize(kSwitchNames)); |
252 } | 322 } |
253 } | 323 } |
254 | 324 |
255 std::string ChromeContentBrowserClient::GetApplicationLocale() { | 325 std::string ChromeContentBrowserClient::GetApplicationLocale() { |
256 return g_browser_process->GetApplicationLocale(); | 326 return g_browser_process->GetApplicationLocale(); |
257 } | 327 } |
258 | 328 |
259 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { | 329 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { |
260 return tab->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); | 330 return tab->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); |
261 } | 331 } |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 #if defined(USE_NSS) | 588 #if defined(USE_NSS) |
519 crypto::CryptoModuleBlockingPasswordDelegate* | 589 crypto::CryptoModuleBlockingPasswordDelegate* |
520 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 590 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
521 const GURL& url) { | 591 const GURL& url) { |
522 return browser::NewCryptoModuleBlockingDialogDelegate( | 592 return browser::NewCryptoModuleBlockingDialogDelegate( |
523 browser::kCryptoModulePasswordKeygen, url.host()); | 593 browser::kCryptoModulePasswordKeygen, url.host()); |
524 } | 594 } |
525 #endif | 595 #endif |
526 | 596 |
527 } // namespace chrome | 597 } // namespace chrome |
OLD | NEW |