Chromium Code Reviews| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 // Multiple sites may share the same RenderProcessHost, so check if this | 56 // Multiple sites may share the same RenderProcessHost, so check if this |
| 57 // notification has already been added. | 57 // notification has already been added. |
| 58 content::Source<content::RenderProcessHost> rph_source( | 58 content::Source<content::RenderProcessHost> rph_source( |
| 59 preview_dialog->GetRenderProcessHost()); | 59 preview_dialog->GetRenderProcessHost()); |
| 60 if (!registrar_.IsRegistered(this, | 60 if (!registrar_.IsRegistered(this, |
| 61 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, rph_source)) { | 61 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, rph_source)) { |
| 62 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 62 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 63 rph_source); | 63 rph_source); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Activate the initiator tab. | 66 // Activate the initiator. |
| 67 PrintPreviewDialogController* dialog_controller = | 67 PrintPreviewDialogController* dialog_controller = |
| 68 PrintPreviewDialogController::GetInstance(); | 68 PrintPreviewDialogController::GetInstance(); |
| 69 if (!dialog_controller) | 69 if (!dialog_controller) |
| 70 return; | 70 return; |
| 71 WebContents* initiator_tab = | 71 WebContents* initiator = |
| 72 dialog_controller->GetInitiatorTab(preview_dialog); | 72 dialog_controller->GetInitiator(preview_dialog); |
|
Lei Zhang
2013/06/29 00:24:18
nit: fits on the previous line.
Mike Wittman
2013/07/01 17:16:12
Done.
| |
| 73 if (!initiator_tab) | 73 if (!initiator) |
| 74 return; | 74 return; |
| 75 initiator_tab->GetDelegate()->ActivateContents(initiator_tab); | 75 initiator->GetDelegate()->ActivateContents(initiator); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void BackgroundPrintingManager::Observe( | 78 void BackgroundPrintingManager::Observe( |
| 79 int type, | 79 int type, |
| 80 const content::NotificationSource& source, | 80 const content::NotificationSource& source, |
| 81 const content::NotificationDetails& details) { | 81 const content::NotificationDetails& details) { |
| 82 if (type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED) { | 82 if (type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED) { |
| 83 OnRendererProcessClosed( | 83 OnRendererProcessClosed( |
| 84 content::Source<content::RenderProcessHost>(source).ptr()); | 84 content::Source<content::RenderProcessHost>(source).ptr()); |
| 85 } else if (type == chrome::NOTIFICATION_PRINT_JOB_RELEASED) { | 85 } else if (type == chrome::NOTIFICATION_PRINT_JOB_RELEASED) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |