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" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
13 #include "content/public/browser/render_process_host_observer.h" | 13 #include "content/public/browser/render_process_host_observer.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "content/common/view_messages.h" | 15 #include "content/common/view_messages.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class MHTMLGenerationManager::Job : public RenderProcessHostObserver { | 19 class MHTMLGenerationManager::Job : public RenderProcessHostObserver { |
20 public: | 20 public: |
21 Job(); | 21 Job(); |
22 virtual ~Job(); | 22 ~Job() override; |
23 | 23 |
24 void SetWebContents(WebContents* web_contents); | 24 void SetWebContents(WebContents* web_contents); |
25 | 25 |
26 base::File browser_file() { return browser_file_.Pass(); } | 26 base::File browser_file() { return browser_file_.Pass(); } |
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 void RenderProcessExited(RenderProcessHost* host, |
37 base::TerminationStatus status, | 37 base::TerminationStatus status, |
38 int exit_code) override; | 38 int exit_code) override; |
39 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) override; | 39 void RenderProcessHostDestroyed(RenderProcessHost* host) override; |
40 | |
41 | 40 |
42 private: | 41 private: |
43 // The handle to the file the MHTML is saved to for the browser process. | 42 // The handle to the file the MHTML is saved to for the browser process. |
44 base::File browser_file_; | 43 base::File browser_file_; |
45 | 44 |
46 // The IDs mapping to a specific contents. | 45 // The IDs mapping to a specific contents. |
47 int process_id_; | 46 int process_id_; |
48 int routing_id_; | 47 int routing_id_; |
49 | 48 |
50 // The callback to call once generation is complete. | 49 // The callback to call once generation is complete. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 ++it) { | 229 ++it) { |
231 if (it->second == job) { | 230 if (it->second == job) { |
232 JobFinished(it->first, -1); | 231 JobFinished(it->first, -1); |
233 return; | 232 return; |
234 } | 233 } |
235 } | 234 } |
236 NOTREACHED(); | 235 NOTREACHED(); |
237 } | 236 } |
238 | 237 |
239 } // namespace content | 238 } // namespace content |
OLD | NEW |