Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: chrome/browser/printing/background_printing_manager.cc

Issue 17500003: Close web contents modal dialogs on content load start (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compilation fixes, change "inhibit" variable names Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/printing/print_preview_dialog_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = dialog_controller->GetInitiator(preview_dialog);
72 dialog_controller->GetInitiatorTab(preview_dialog); 72 if (!initiator)
73 if (!initiator_tab)
74 return; 73 return;
75 initiator_tab->GetDelegate()->ActivateContents(initiator_tab); 74 initiator->GetDelegate()->ActivateContents(initiator);
76 } 75 }
77 76
78 void BackgroundPrintingManager::Observe( 77 void BackgroundPrintingManager::Observe(
79 int type, 78 int type,
80 const content::NotificationSource& source, 79 const content::NotificationSource& source,
81 const content::NotificationDetails& details) { 80 const content::NotificationDetails& details) {
82 if (type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED) { 81 if (type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED) {
83 OnRendererProcessClosed( 82 OnRendererProcessClosed(
84 content::Source<content::RenderProcessHost>(source).ptr()); 83 content::Source<content::RenderProcessHost>(source).ptr());
85 } else if (type == chrome::NOTIFICATION_PRINT_JOB_RELEASED) { 84 } else if (type == chrome::NOTIFICATION_PRINT_JOB_RELEASED) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return printing_contents_set_.end(); 178 return printing_contents_set_.end();
180 } 179 }
181 180
182 bool BackgroundPrintingManager::HasPrintPreviewDialog( 181 bool BackgroundPrintingManager::HasPrintPreviewDialog(
183 WebContents* preview_dialog) { 182 WebContents* preview_dialog) {
184 return (ContainsKey(printing_contents_set_, preview_dialog) || 183 return (ContainsKey(printing_contents_set_, preview_dialog) ||
185 ContainsKey(printing_contents_pending_deletion_set_, preview_dialog)); 184 ContainsKey(printing_contents_pending_deletion_set_, preview_dialog));
186 } 185 }
187 186
188 } // namespace printing 187 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/printing/print_preview_dialog_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698