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 "chrome/browser/printing/print_job.h" | 7 #include "chrome/browser/printing/print_job.h" |
8 #include "chrome/browser/printing/print_preview_tab_controller.h" | 8 #include "chrome/browser/printing/print_preview_tab_controller.h" |
9 #include "chrome/browser/sessions/restore_tab_helper.h" | 9 #include "chrome/browser/sessions/restore_tab_helper.h" |
10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/notification_details.h" | 15 #include "content/public/browser/notification_details.h" |
16 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
17 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
18 #include "content/public/browser/render_view_host_delegate.h" | |
19 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 #include "content/public/browser/web_contents_delegate.h" |
20 | 20 |
21 using content::BrowserThread; | 21 using content::BrowserThread; |
22 using content::WebContents; | 22 using content::WebContents; |
23 | 23 |
24 namespace printing { | 24 namespace printing { |
25 | 25 |
26 BackgroundPrintingManager::BackgroundPrintingManager() { | 26 BackgroundPrintingManager::BackgroundPrintingManager() { |
27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
28 } | 28 } |
29 | 29 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // Activate the initiator tab. | 74 // Activate the initiator tab. |
75 PrintPreviewTabController* tab_controller = | 75 PrintPreviewTabController* tab_controller = |
76 PrintPreviewTabController::GetInstance(); | 76 PrintPreviewTabController::GetInstance(); |
77 if (!tab_controller) | 77 if (!tab_controller) |
78 return; | 78 return; |
79 TabContentsWrapper* initiator_tab = | 79 TabContentsWrapper* initiator_tab = |
80 tab_controller->GetInitiatorTab(preview_tab); | 80 tab_controller->GetInitiatorTab(preview_tab); |
81 if (!initiator_tab) | 81 if (!initiator_tab) |
82 return; | 82 return; |
83 initiator_tab->web_contents()->GetRenderViewHost()->GetDelegate()->Activate(); | 83 WebContents* web_contents = initiator_tab->web_contents(); |
| 84 web_contents->GetDelegate()->ActivateContents(web_contents); |
84 } | 85 } |
85 | 86 |
86 void BackgroundPrintingManager::Observe( | 87 void BackgroundPrintingManager::Observe( |
87 int type, | 88 int type, |
88 const content::NotificationSource& source, | 89 const content::NotificationSource& source, |
89 const content::NotificationDetails& details) { | 90 const content::NotificationDetails& details) { |
90 switch (type) { | 91 switch (type) { |
91 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { | 92 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { |
92 OnRendererProcessClosed( | 93 OnRendererProcessClosed( |
93 content::Source<content::RenderProcessHost>(source).ptr()); | 94 content::Source<content::RenderProcessHost>(source).ptr()); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 203 |
203 bool BackgroundPrintingManager::HasPrintPreviewTab( | 204 bool BackgroundPrintingManager::HasPrintPreviewTab( |
204 TabContentsWrapper* preview_tab) { | 205 TabContentsWrapper* preview_tab) { |
205 if (printing_tabs_.find(preview_tab) != printing_tabs_.end()) | 206 if (printing_tabs_.find(preview_tab) != printing_tabs_.end()) |
206 return true; | 207 return true; |
207 return printing_tabs_pending_deletion_.find(preview_tab) != | 208 return printing_tabs_pending_deletion_.find(preview_tab) != |
208 printing_tabs_pending_deletion_.end(); | 209 printing_tabs_pending_deletion_.end(); |
209 } | 210 } |
210 | 211 |
211 } // namespace printing | 212 } // namespace printing |
OLD | NEW |