| 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 // 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 "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 RenderProcessHostImpl::RenderProcessHostImpl( | 272 RenderProcessHostImpl::RenderProcessHostImpl( |
| 273 content::BrowserContext* browser_context) | 273 content::BrowserContext* browser_context) |
| 274 : fast_shutdown_started_(false), | 274 : fast_shutdown_started_(false), |
| 275 deleting_soon_(false), | 275 deleting_soon_(false), |
| 276 pending_views_(0), | 276 pending_views_(0), |
| 277 visible_widgets_(0), | 277 visible_widgets_(0), |
| 278 backgrounded_(true), | 278 backgrounded_(true), |
| 279 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( | 279 ALLOW_THIS_IN_INITIALIZER_LIST(cached_dibs_cleaner_( |
| 280 FROM_HERE, base::TimeDelta::FromSeconds(5), | 280 FROM_HERE, base::TimeDelta::FromSeconds(5), |
| 281 this, &RenderProcessHostImpl::ClearTransportDIBCache)), | 281 this, &RenderProcessHostImpl::ClearTransportDIBCache)), |
| 282 accessibility_enabled_(false), | |
| 283 is_initialized_(false), | 282 is_initialized_(false), |
| 284 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 283 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
| 285 browser_context_(browser_context), | 284 browser_context_(browser_context), |
| 286 sudden_termination_allowed_(true), | 285 sudden_termination_allowed_(true), |
| 287 ignore_input_events_(false) { | 286 ignore_input_events_(false) { |
| 288 widget_helper_ = new RenderWidgetHelper(); | 287 widget_helper_ = new RenderWidgetHelper(); |
| 289 | 288 |
| 290 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 289 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
| 291 | 290 |
| 292 // Grant most file permissions to this renderer. | 291 // Grant most file permissions to this renderer. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 345 } |
| 347 | 346 |
| 348 ClearTransportDIBCache(); | 347 ClearTransportDIBCache(); |
| 349 UnregisterHost(GetID()); | 348 UnregisterHost(GetID()); |
| 350 } | 349 } |
| 351 | 350 |
| 352 void RenderProcessHostImpl::EnableSendQueue() { | 351 void RenderProcessHostImpl::EnableSendQueue() { |
| 353 is_initialized_ = false; | 352 is_initialized_ = false; |
| 354 } | 353 } |
| 355 | 354 |
| 356 bool RenderProcessHostImpl::Init(bool is_accessibility_enabled) { | 355 bool RenderProcessHostImpl::Init() { |
| 357 // calling Init() more than once does nothing, this makes it more convenient | 356 // calling Init() more than once does nothing, this makes it more convenient |
| 358 // for the view host which may not be sure in some cases | 357 // for the view host which may not be sure in some cases |
| 359 if (channel_.get()) | 358 if (channel_.get()) |
| 360 return true; | 359 return true; |
| 361 | 360 |
| 362 accessibility_enabled_ = is_accessibility_enabled; | |
| 363 | |
| 364 CommandLine::StringType renderer_prefix; | 361 CommandLine::StringType renderer_prefix; |
| 365 #if defined(OS_POSIX) | 362 #if defined(OS_POSIX) |
| 366 // A command prefix is something prepended to the command line of the spawned | 363 // A command prefix is something prepended to the command line of the spawned |
| 367 // process. It is supported only on POSIX systems. | 364 // process. It is supported only on POSIX systems. |
| 368 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 365 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 369 renderer_prefix = | 366 renderer_prefix = |
| 370 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); | 367 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); |
| 371 #endif // defined(OS_POSIX) | 368 #endif // defined(OS_POSIX) |
| 372 | 369 |
| 373 #if defined(OS_LINUX) | 370 #if defined(OS_LINUX) |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 int RenderProcessHostImpl::VisibleWidgetCount() const { | 604 int RenderProcessHostImpl::VisibleWidgetCount() const { |
| 608 return visible_widgets_; | 605 return visible_widgets_; |
| 609 } | 606 } |
| 610 | 607 |
| 611 void RenderProcessHostImpl::AppendRendererCommandLine( | 608 void RenderProcessHostImpl::AppendRendererCommandLine( |
| 612 CommandLine* command_line) const { | 609 CommandLine* command_line) const { |
| 613 // Pass the process type first, so it shows first in process listings. | 610 // Pass the process type first, so it shows first in process listings. |
| 614 command_line->AppendSwitchASCII(switches::kProcessType, | 611 command_line->AppendSwitchASCII(switches::kProcessType, |
| 615 switches::kRendererProcess); | 612 switches::kRendererProcess); |
| 616 | 613 |
| 617 if (accessibility_enabled_) | |
| 618 command_line->AppendSwitch(switches::kEnableAccessibility); | |
| 619 | |
| 620 // Now send any options from our own command line we want to propagate. | 614 // Now send any options from our own command line we want to propagate. |
| 621 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 615 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 622 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); | 616 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); |
| 623 | 617 |
| 624 // Pass on the browser locale. | 618 // Pass on the browser locale. |
| 625 const std::string locale = | 619 const std::string locale = |
| 626 content::GetContentClient()->browser()->GetApplicationLocale(); | 620 content::GetContentClient()->browser()->GetApplicationLocale(); |
| 627 command_line->AppendSwitchASCII(switches::kLang, locale); | 621 command_line->AppendSwitchASCII(switches::kLang, locale); |
| 628 | 622 |
| 629 // If we run base::FieldTrials, we want to pass to their state to the | 623 // If we run base::FieldTrials, we want to pass to their state to the |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { | 1337 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { |
| 1344 // Only honor the request if appropriate persmissions are granted. | 1338 // Only honor the request if appropriate persmissions are granted. |
| 1345 if (ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(GetID(), | 1339 if (ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(GetID(), |
| 1346 path)) | 1340 path)) |
| 1347 content::GetContentClient()->browser()->OpenItem(path); | 1341 content::GetContentClient()->browser()->OpenItem(path); |
| 1348 } | 1342 } |
| 1349 | 1343 |
| 1350 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1344 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
| 1351 MHTMLGenerationManager::GetInstance()->MHTMLGenerated(job_id, data_size); | 1345 MHTMLGenerationManager::GetInstance()->MHTMLGenerated(job_id, data_size); |
| 1352 } | 1346 } |
| OLD | NEW |