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

Unified Diff: chrome/browser/printing/background_printing_manager.h

Issue 7800036: Print Preview: Hold on to tabs that do window.print(); window.close() until print preview finishes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/printing/background_printing_manager.h
===================================================================
--- chrome/browser/printing/background_printing_manager.h (revision 99671)
+++ chrome/browser/printing/background_printing_manager.h (working copy)
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_
#pragma once
+#include <map>
#include <set>
#include "base/compiler_specific.h"
@@ -13,6 +14,7 @@
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
+class RenderProcessHost;
class TabContentsWrapper;
namespace printing {
@@ -33,6 +35,13 @@
// hides it from the user.
void OwnPrintPreviewTab(TabContentsWrapper* preview_tab);
+ // Takes ownership of |initiator_tab| and deletes it when its preview tab is
+ // destroyed by either being canceled, closed or finishing printing. This
+ // removes the TabContentsWrapper from its TabStrip and hides it from the
+ // user. Returns true if content has an associated print preview tab,
+ // otherwise, returns false and does not take ownership of |initiator_tab|.
+ bool OwnInitiatorTab(TabContentsWrapper* initiator_tab);
+
// Let others iterate over the list of background printing tabs.
TabContentsWrapperSet::const_iterator begin();
TabContentsWrapperSet::const_iterator end();
@@ -46,9 +55,24 @@
const NotificationDetails& details) OVERRIDE;
private:
+ // Notifications handlers.
+ void OnRendererProcessClosed(RenderProcessHost* rph);
+ void OnPrintJobReleased(TabContentsWrapper* preview_tab);
+ void OnTabContentsDestroyed(TabContentsWrapper* preview_tab);
+
+ // Removes |tab| from its tab strip.
+ void RemoveFromTabStrip(TabContentsWrapper* tab);
+
// The set of print preview tabs managed by BackgroundPrintingManager.
TabContentsWrapperSet printing_tabs_;
+ // The set of initiator tabs managed by BackgroundPrintingManager.
+ TabContentsWrapperSet initiator_tabs_;
kmadhusu 2011/09/07 23:21:10 (repeating our in-person conversation): initiator_
Lei Zhang 2011/09/07 23:41:16 Done.
+
+ // 1:1 mapping between a print preview tab and an initiator tab in
+ // |initiator_tabs_|.
kmadhusu 2011/09/07 23:21:10 Document Key and Value.
Lei Zhang 2011/09/07 23:41:16 Done.
+ std::map<TabContentsWrapper*, TabContentsWrapper*> map_;
kmadhusu 2011/09/07 23:21:10 In the .cc file, I did not see any code to erase t
kmadhusu 2011/09/07 23:21:10 Add a comment explaining the scenario at which map
Lei Zhang 2011/09/07 23:41:16 Done.
Lei Zhang 2011/09/07 23:41:16 Done.
+
NotificationRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager);

Powered by Google App Engine
This is Rietveld 408576698