| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 #include "third_party/skia/include/core/SkBitmap.h" | 115 #include "third_party/skia/include/core/SkBitmap.h" |
| 116 | 116 |
| 117 using content::BrowserMessageFilter; | 117 using content::BrowserMessageFilter; |
| 118 using content::BrowserThread; | 118 using content::BrowserThread; |
| 119 using content::ChildProcessHost; | 119 using content::ChildProcessHost; |
| 120 using content::ChildProcessHostImpl; | 120 using content::ChildProcessHostImpl; |
| 121 using content::UserMetricsAction; | 121 using content::UserMetricsAction; |
| 122 using content::WebUIControllerFactory; | 122 using content::WebUIControllerFactory; |
| 123 | 123 |
| 124 extern bool g_exited_main_message_loop; |
| 125 |
| 124 // This class creates the IO thread for the renderer when running in | 126 // This class creates the IO thread for the renderer when running in |
| 125 // single-process mode. It's not used in multi-process mode. | 127 // single-process mode. It's not used in multi-process mode. |
| 126 class RendererMainThread : public base::Thread { | 128 class RendererMainThread : public base::Thread { |
| 127 public: | 129 public: |
| 128 explicit RendererMainThread(const std::string& channel_id) | 130 explicit RendererMainThread(const std::string& channel_id) |
| 129 : base::Thread("Chrome_InProcRendererThread"), | 131 : base::Thread("Chrome_InProcRendererThread"), |
| 130 channel_id_(channel_id), | 132 channel_id_(channel_id), |
| 131 render_process_(NULL) { | 133 render_process_(NULL) { |
| 132 } | 134 } |
| 133 | 135 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE | | 310 base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE | |
| 309 base::PLATFORM_FILE_WRITE_ATTRIBUTES | base::PLATFORM_FILE_ENUMERATE); | 311 base::PLATFORM_FILE_WRITE_ATTRIBUTES | base::PLATFORM_FILE_ENUMERATE); |
| 310 // This is so that we can rename the old sandbox out of the way so that we | 312 // This is so that we can rename the old sandbox out of the way so that we |
| 311 // know we've taken care of it. | 313 // know we've taken care of it. |
| 312 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( | 314 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( |
| 313 GetID(), browser_context->GetPath().Append( | 315 GetID(), browser_context->GetPath().Append( |
| 314 fileapi::SandboxMountPointProvider::kRenamedOldFileSystemDirectory), | 316 fileapi::SandboxMountPointProvider::kRenamedOldFileSystemDirectory), |
| 315 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS | | 317 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS | |
| 316 base::PLATFORM_FILE_WRITE); | 318 base::PLATFORM_FILE_WRITE); |
| 317 | 319 |
| 318 CHECK(!content::ExitedMainMessageLoop()); | 320 CHECK(!g_exited_main_message_loop); |
| 319 RegisterHost(GetID(), this); | 321 RegisterHost(GetID(), this); |
| 320 g_all_hosts.Get().set_check_on_null_data(true); | 322 g_all_hosts.Get().set_check_on_null_data(true); |
| 321 // Initialize |child_process_activity_time_| to a reasonable value. | 323 // Initialize |child_process_activity_time_| to a reasonable value. |
| 322 mark_child_process_activity_time(); | 324 mark_child_process_activity_time(); |
| 323 // Note: When we create the RenderProcessHostImpl, it's technically | 325 // Note: When we create the RenderProcessHostImpl, it's technically |
| 324 // backgrounded, because it has no visible listeners. But the process | 326 // backgrounded, because it has no visible listeners. But the process |
| 325 // doesn't actually exist yet, so we'll Background it later, after | 327 // doesn't actually exist yet, so we'll Background it later, after |
| 326 // creation. | 328 // creation. |
| 327 } | 329 } |
| 328 | 330 |
| (...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { | 1296 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { |
| 1295 // Only honor the request if appropriate persmissions are granted. | 1297 // Only honor the request if appropriate persmissions are granted. |
| 1296 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) | 1298 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) |
| 1297 content::GetContentClient()->browser()->OpenItem(path); | 1299 content::GetContentClient()->browser()->OpenItem(path); |
| 1298 } | 1300 } |
| 1299 | 1301 |
| 1300 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1302 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
| 1301 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 1303 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
| 1302 MHTMLGenerated(job_id, data_size); | 1304 MHTMLGenerated(job_id, data_size); |
| 1303 } | 1305 } |
| OLD | NEW |