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/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/printing/print_job.h" | 9 #include "chrome/browser/printing/print_job.h" |
10 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 10 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 content::Source<WebContents>(preview_dialog)); | 76 content::Source<WebContents>(preview_dialog)); |
77 | 77 |
78 // Activate the initiator. | 78 // Activate the initiator. |
79 PrintPreviewDialogController* dialog_controller = | 79 PrintPreviewDialogController* dialog_controller = |
80 PrintPreviewDialogController::GetInstance(); | 80 PrintPreviewDialogController::GetInstance(); |
81 if (!dialog_controller) | 81 if (!dialog_controller) |
82 return; | 82 return; |
83 WebContents* initiator = dialog_controller->GetInitiator(preview_dialog); | 83 WebContents* initiator = dialog_controller->GetInitiator(preview_dialog); |
84 if (!initiator) | 84 if (!initiator) |
85 return; | 85 return; |
86 initiator->GetDelegate()->ActivateContents(initiator); | 86 initiator->GetDelegate()->ActivateContents(initiator, |
| 87 true /* user_gesture */); |
87 } | 88 } |
88 | 89 |
89 void BackgroundPrintingManager::Observe( | 90 void BackgroundPrintingManager::Observe( |
90 int type, | 91 int type, |
91 const content::NotificationSource& source, | 92 const content::NotificationSource& source, |
92 const content::NotificationDetails& details) { | 93 const content::NotificationDetails& details) { |
93 DCHECK_EQ(chrome::NOTIFICATION_PRINT_JOB_RELEASED, type); | 94 DCHECK_EQ(chrome::NOTIFICATION_PRINT_JOB_RELEASED, type); |
94 DeletePreviewContents(content::Source<WebContents>(source).ptr()); | 95 DeletePreviewContents(content::Source<WebContents>(source).ptr()); |
95 } | 96 } |
96 | 97 |
(...skipping 28 matching lines...) Expand all Loading... |
125 } | 126 } |
126 return result; | 127 return result; |
127 } | 128 } |
128 | 129 |
129 bool BackgroundPrintingManager::HasPrintPreviewDialog( | 130 bool BackgroundPrintingManager::HasPrintPreviewDialog( |
130 WebContents* preview_dialog) { | 131 WebContents* preview_dialog) { |
131 return ContainsKey(printing_contents_map_, preview_dialog); | 132 return ContainsKey(printing_contents_map_, preview_dialog); |
132 } | 133 } |
133 | 134 |
134 } // namespace printing | 135 } // namespace printing |
OLD | NEW |