| 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 #include "content/browser/download/mhtml_generation_manager.h" | 5 #include "content/browser/download/mhtml_generation_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 void set_browser_file(base::File file) { browser_file_ = file.Pass(); } | 27 void set_browser_file(base::File file) { browser_file_ = file.Pass(); } |
| 28 | 28 |
| 29 int process_id() { return process_id_; } | 29 int process_id() { return process_id_; } |
| 30 int routing_id() { return routing_id_; } | 30 int routing_id() { return routing_id_; } |
| 31 | 31 |
| 32 GenerateMHTMLCallback callback() { return callback_; } | 32 GenerateMHTMLCallback callback() { return callback_; } |
| 33 void set_callback(GenerateMHTMLCallback callback) { callback_ = callback; } | 33 void set_callback(GenerateMHTMLCallback callback) { callback_ = callback; } |
| 34 | 34 |
| 35 // RenderProcessHostObserver: | 35 // RenderProcessHostObserver: |
| 36 virtual void RenderProcessExited(RenderProcessHost* host, | 36 virtual void RenderProcessExited(RenderProcessHost* host, |
| 37 base::ProcessHandle handle, | |
| 38 base::TerminationStatus status, | 37 base::TerminationStatus status, |
| 39 int exit_code) override; | 38 int exit_code) override; |
| 40 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) override; | 39 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) override; |
| 41 | 40 |
| 42 | 41 |
| 43 private: | 42 private: |
| 44 // The handle to the file the MHTML is saved to for the browser process. | 43 // The handle to the file the MHTML is saved to for the browser process. |
| 45 base::File browser_file_; | 44 base::File browser_file_; |
| 46 | 45 |
| 47 // The IDs mapping to a specific contents. | 46 // The IDs mapping to a specific contents. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 69 | 68 |
| 70 void MHTMLGenerationManager::Job::SetWebContents(WebContents* web_contents) { | 69 void MHTMLGenerationManager::Job::SetWebContents(WebContents* web_contents) { |
| 71 process_id_ = web_contents->GetRenderProcessHost()->GetID(); | 70 process_id_ = web_contents->GetRenderProcessHost()->GetID(); |
| 72 routing_id_ = web_contents->GetRenderViewHost()->GetRoutingID(); | 71 routing_id_ = web_contents->GetRenderViewHost()->GetRoutingID(); |
| 73 host_ = web_contents->GetRenderProcessHost(); | 72 host_ = web_contents->GetRenderProcessHost(); |
| 74 host_->AddObserver(this); | 73 host_->AddObserver(this); |
| 75 } | 74 } |
| 76 | 75 |
| 77 void MHTMLGenerationManager::Job::RenderProcessExited( | 76 void MHTMLGenerationManager::Job::RenderProcessExited( |
| 78 RenderProcessHost* host, | 77 RenderProcessHost* host, |
| 79 base::ProcessHandle handle, | |
| 80 base::TerminationStatus status, | 78 base::TerminationStatus status, |
| 81 int exit_code) { | 79 int exit_code) { |
| 82 MHTMLGenerationManager::GetInstance()->RenderProcessExited(this); | 80 MHTMLGenerationManager::GetInstance()->RenderProcessExited(this); |
| 83 } | 81 } |
| 84 | 82 |
| 85 void MHTMLGenerationManager::Job::RenderProcessHostDestroyed( | 83 void MHTMLGenerationManager::Job::RenderProcessHostDestroyed( |
| 86 RenderProcessHost* host) { | 84 RenderProcessHost* host) { |
| 87 host_ = NULL; | 85 host_ = NULL; |
| 88 } | 86 } |
| 89 | 87 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 ++it) { | 230 ++it) { |
| 233 if (it->second == job) { | 231 if (it->second == job) { |
| 234 JobFinished(it->first, -1); | 232 JobFinished(it->first, -1); |
| 235 return; | 233 return; |
| 236 } | 234 } |
| 237 } | 235 } |
| 238 NOTREACHED(); | 236 NOTREACHED(); |
| 239 } | 237 } |
| 240 | 238 |
| 241 } // namespace content | 239 } // namespace content |
| OLD | NEW |