| 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 "chrome/browser/printing/background_printing_manager.h" | 5 #include "chrome/browser/printing/background_printing_manager.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "chrome/browser/printing/print_job.h" | 8 #include "chrome/browser/printing/print_job.h" |
| 9 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 9 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 printing_contents_pending_deletion_set_.erase(preview_contents); | 146 printing_contents_pending_deletion_set_.erase(preview_contents); |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 void BackgroundPrintingManager::DeletePreviewContents( | 150 void BackgroundPrintingManager::DeletePreviewContents( |
| 151 WebContents* preview_contents) { | 151 WebContents* preview_contents) { |
| 152 registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, | 152 registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, |
| 153 content::Source<WebContents>(preview_contents)); | 153 content::Source<WebContents>(preview_contents)); |
| 154 printing_contents_set_.erase(preview_contents); | 154 printing_contents_set_.erase(preview_contents); |
| 155 printing_contents_pending_deletion_set_.insert(preview_contents); | 155 printing_contents_pending_deletion_set_.insert(preview_contents); |
| 156 MessageLoop::current()->DeleteSoon(FROM_HERE, preview_contents); | 156 base::MessageLoop::current()->DeleteSoon(FROM_HERE, preview_contents); |
| 157 } | 157 } |
| 158 | 158 |
| 159 bool BackgroundPrintingManager::HasSharedRenderProcessHost( | 159 bool BackgroundPrintingManager::HasSharedRenderProcessHost( |
| 160 const WebContentsSet& set, WebContents* preview_contents) { | 160 const WebContentsSet& set, WebContents* preview_contents) { |
| 161 content::RenderProcessHost* rph = preview_contents->GetRenderProcessHost(); | 161 content::RenderProcessHost* rph = preview_contents->GetRenderProcessHost(); |
| 162 for (WebContentsSet::const_iterator it = set.begin(); it != set.end(); ++it) { | 162 for (WebContentsSet::const_iterator it = set.begin(); it != set.end(); ++it) { |
| 163 WebContents* iter_contents = *it; | 163 WebContents* iter_contents = *it; |
| 164 if (iter_contents == preview_contents) | 164 if (iter_contents == preview_contents) |
| 165 continue; | 165 continue; |
| 166 if (iter_contents->GetRenderProcessHost() == rph) | 166 if (iter_contents->GetRenderProcessHost() == rph) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 179 return printing_contents_set_.end(); | 179 return printing_contents_set_.end(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 bool BackgroundPrintingManager::HasPrintPreviewDialog( | 182 bool BackgroundPrintingManager::HasPrintPreviewDialog( |
| 183 WebContents* preview_dialog) { | 183 WebContents* preview_dialog) { |
| 184 return (ContainsKey(printing_contents_set_, preview_dialog) || | 184 return (ContainsKey(printing_contents_set_, preview_dialog) || |
| 185 ContainsKey(printing_contents_pending_deletion_set_, preview_dialog)); | 185 ContainsKey(printing_contents_pending_deletion_set_, preview_dialog)); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace printing | 188 } // namespace printing |
| OLD | NEW |