OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/download/mhtml_generation_manager.h" | 5 #include "chrome/browser/download/mhtml_generation_manager.h" |
6 | 6 |
7 #include "base/platform_file.h" | 7 #include "base/platform_file.h" |
8 #include "chrome/browser/tab_contents/tab_util.h" | 8 #include "chrome/browser/tab_contents/tab_util.h" |
| 9 #include "chrome/common/chrome_notification_types.h" |
9 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
10 #include "content/browser/renderer_host/render_process_host.h" | 11 #include "content/browser/renderer_host/render_process_host.h" |
11 #include "content/browser/renderer_host/render_view_host.h" | 12 #include "content/browser/renderer_host/render_view_host.h" |
12 #include "content/browser/tab_contents/tab_contents.h" | 13 #include "content/browser/tab_contents/tab_contents.h" |
13 #include "content/common/notification_service.h" | 14 #include "content/common/notification_service.h" |
14 #include "content/common/page_transition_types.h" | 15 #include "content/common/page_transition_types.h" |
15 | 16 |
16 MHTMLGenerationManager::Job::Job() | 17 MHTMLGenerationManager::Job::Job() |
17 : browser_file(base::kInvalidPlatformFileValue), | 18 : browser_file(base::kInvalidPlatformFileValue), |
18 renderer_file(IPC::InvalidPlatformFileForTransit()), | 19 renderer_file(IPC::InvalidPlatformFileForTransit()), |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 Job& job = iter->second; | 112 Job& job = iter->second; |
112 | 113 |
113 TabContents* tab_contents = | 114 TabContents* tab_contents = |
114 tab_util::GetTabContentsByID(job.process_id, job.routing_id); | 115 tab_util::GetTabContentsByID(job.process_id, job.routing_id); |
115 if (tab_contents) { | 116 if (tab_contents) { |
116 NotificationDetails details; | 117 NotificationDetails details; |
117 details.file_path = job.file_path; | 118 details.file_path = job.file_path; |
118 details.success = success; | 119 details.success = success; |
119 | 120 |
120 NotificationService::current()->Notify( | 121 NotificationService::current()->Notify( |
121 NotificationType::MHTML_GENERATED, | 122 chrome::NOTIFICATION_MHTML_GENERATED, |
122 Source<RenderViewHost>(tab_contents->render_view_host()), | 123 Source<RenderViewHost>(tab_contents->render_view_host()), |
123 Details<NotificationDetails>(&details)); | 124 Details<NotificationDetails>(&details)); |
124 } | 125 } |
125 | 126 |
126 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 127 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
127 NewRunnableMethod(this, &MHTMLGenerationManager::CloseFile, | 128 NewRunnableMethod(this, &MHTMLGenerationManager::CloseFile, |
128 job.browser_file)); | 129 job.browser_file)); |
129 | 130 |
130 id_to_job_.erase(job_id); | 131 id_to_job_.erase(job_id); |
131 } | 132 } |
132 | 133 |
133 void MHTMLGenerationManager::CloseFile(base::PlatformFile file) { | 134 void MHTMLGenerationManager::CloseFile(base::PlatformFile file) { |
134 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
135 base::ClosePlatformFile(file); | 136 base::ClosePlatformFile(file); |
136 } | 137 } |
OLD | NEW |