OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 VisitedLinkCommon::Fingerprints pending_; | 194 VisitedLinkCommon::Fingerprints pending_; |
195 }; | 195 }; |
196 | 196 |
197 BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile) | 197 BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile) |
198 : RenderProcessHost(profile), | 198 : RenderProcessHost(profile), |
199 visible_widgets_(0), | 199 visible_widgets_(0), |
200 backgrounded_(true), | 200 backgrounded_(true), |
201 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( | 201 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( |
202 base::TimeDelta::FromSeconds(5), | 202 base::TimeDelta::FromSeconds(5), |
203 this, &BrowserRenderProcessHost::ClearTransportDIBCache)), | 203 this, &BrowserRenderProcessHost::ClearTransportDIBCache)), |
| 204 accessibility_enabled_(false), |
204 extension_process_(false) { | 205 extension_process_(false) { |
205 widget_helper_ = new RenderWidgetHelper(); | 206 widget_helper_ = new RenderWidgetHelper(); |
206 | 207 |
207 registrar_.Add(this, NotificationType::USER_SCRIPTS_UPDATED, | 208 registrar_.Add(this, NotificationType::USER_SCRIPTS_UPDATED, |
208 Source<Profile>(profile->GetOriginalProfile())); | 209 Source<Profile>(profile->GetOriginalProfile())); |
209 registrar_.Add(this, NotificationType::EXTENSION_LOADED, | 210 registrar_.Add(this, NotificationType::EXTENSION_LOADED, |
210 Source<Profile>(profile->GetOriginalProfile())); | 211 Source<Profile>(profile->GetOriginalProfile())); |
211 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, | 212 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, |
212 Source<Profile>(profile->GetOriginalProfile())); | 213 Source<Profile>(profile->GetOriginalProfile())); |
213 registrar_.Add(this, NotificationType::SPELLCHECK_HOST_REINITIALIZED, | 214 registrar_.Add(this, NotificationType::SPELLCHECK_HOST_REINITIALIZED, |
(...skipping 25 matching lines...) Expand all Loading... |
239 queued_messages_.pop(); | 240 queued_messages_.pop(); |
240 } | 241 } |
241 | 242 |
242 // Destroy the AudioRendererHost properly. | 243 // Destroy the AudioRendererHost properly. |
243 if (audio_renderer_host_.get()) | 244 if (audio_renderer_host_.get()) |
244 audio_renderer_host_->Destroy(); | 245 audio_renderer_host_->Destroy(); |
245 | 246 |
246 ClearTransportDIBCache(); | 247 ClearTransportDIBCache(); |
247 } | 248 } |
248 | 249 |
249 bool BrowserRenderProcessHost::Init(bool is_extensions_process) { | 250 bool BrowserRenderProcessHost::Init( |
| 251 bool is_accessibility_enabled, bool is_extensions_process) { |
250 // calling Init() more than once does nothing, this makes it more convenient | 252 // calling Init() more than once does nothing, this makes it more convenient |
251 // for the view host which may not be sure in some cases | 253 // for the view host which may not be sure in some cases |
252 if (channel_.get()) | 254 if (channel_.get()) |
253 return true; | 255 return true; |
254 | 256 |
| 257 accessibility_enabled_ = is_accessibility_enabled; |
| 258 |
255 // It is possible for an extension process to be reused for non-extension | 259 // It is possible for an extension process to be reused for non-extension |
256 // content, e.g. if an extension calls window.open. | 260 // content, e.g. if an extension calls window.open. |
257 extension_process_ = extension_process_ || is_extensions_process; | 261 extension_process_ = extension_process_ || is_extensions_process; |
258 | 262 |
259 // run the IPC channel on the shared IO thread. | 263 // run the IPC channel on the shared IO thread. |
260 base::Thread* io_thread = g_browser_process->io_thread(); | 264 base::Thread* io_thread = g_browser_process->io_thread(); |
261 | 265 |
262 // Construct the AudioRendererHost with the IO thread. | 266 // Construct the AudioRendererHost with the IO thread. |
263 audio_renderer_host_ = new AudioRendererHost(); | 267 audio_renderer_host_ = new AudioRendererHost(); |
264 | 268 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 // Pass the process type first, so it shows first in process listings. | 446 // Pass the process type first, so it shows first in process listings. |
443 // Extensions use a special pseudo-process type to make them distinguishable, | 447 // Extensions use a special pseudo-process type to make them distinguishable, |
444 // even though they're just renderers. | 448 // even though they're just renderers. |
445 command_line->AppendSwitchASCII(switches::kProcessType, | 449 command_line->AppendSwitchASCII(switches::kProcessType, |
446 extension_process_ ? switches::kExtensionProcess : | 450 extension_process_ ? switches::kExtensionProcess : |
447 switches::kRendererProcess); | 451 switches::kRendererProcess); |
448 | 452 |
449 if (logging::DialogsAreSuppressed()) | 453 if (logging::DialogsAreSuppressed()) |
450 command_line->AppendSwitch(switches::kNoErrorDialogs); | 454 command_line->AppendSwitch(switches::kNoErrorDialogs); |
451 | 455 |
| 456 if (accessibility_enabled_) |
| 457 command_line->AppendSwitch(switches::kEnableAccessibility); |
| 458 |
452 // Now send any options from our own command line we want to propogate. | 459 // Now send any options from our own command line we want to propogate. |
453 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 460 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
454 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); | 461 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); |
455 | 462 |
456 // Pass on the browser locale. | 463 // Pass on the browser locale. |
457 const std::string locale = g_browser_process->GetApplicationLocale(); | 464 const std::string locale = g_browser_process->GetApplicationLocale(); |
458 command_line->AppendSwitchASCII(switches::kLang, locale); | 465 command_line->AppendSwitchASCII(switches::kLang, locale); |
459 | 466 |
460 // If we run FieldTrials, we want to pass to their state to the renderer so | 467 // If we run FieldTrials, we want to pass to their state to the renderer so |
461 // that it can act in accordance with each state, or record histograms | 468 // that it can act in accordance with each state, or record histograms |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 IPC::InvalidPlatformFileForTransit(), | 1088 IPC::InvalidPlatformFileForTransit(), |
1082 std::vector<std::string>(), | 1089 std::vector<std::string>(), |
1083 std::string(), | 1090 std::string(), |
1084 false)); | 1091 false)); |
1085 } | 1092 } |
1086 } | 1093 } |
1087 | 1094 |
1088 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { | 1095 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { |
1089 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); | 1096 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); |
1090 } | 1097 } |
OLD | NEW |