Chromium Code Reviews| Index: chrome/browser/printing/background_printing_manager.h |
| diff --git a/chrome/browser/printing/background_printing_manager.h b/chrome/browser/printing/background_printing_manager.h |
| index 4d935fa89d8266f91f85ac831706618c7c5ac365..a6e4caae37feecf65de82f6462212aca0402ca27 100644 |
| --- a/chrome/browser/printing/background_printing_manager.h |
| +++ b/chrome/browser/printing/background_printing_manager.h |
| @@ -24,20 +24,33 @@ class BackgroundPrintingManager |
| : public base::NonThreadSafe, |
| public NotificationObserver { |
| public: |
| + typedef std::set<TabContentsWrapper*> TabContentsWrapperSet; |
| + |
| BackgroundPrintingManager(); |
| virtual ~BackgroundPrintingManager(); |
| // Takes ownership of |content| and deletes it when |content| finishes |
| // printing. This removes the TabContentsWrapper from its TabStrip and |
| // hides it from the user. |
| - void OwnTabContents(TabContentsWrapper* content); |
| + void OwnPreviewTabContents(TabContentsWrapper* contents); |
| + |
| + // Takes ownership of |content| 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 |content|. |
| + bool OwnInitiatorTabContents(TabContentsWrapper* contents); |
| + |
| + // Called when we no longer need to access the initiator tab, deletes if |
| + // currently owned. Returns true when |content| was owned. |
| + bool ReleaseInitiatorTabContents(TabContentsWrapper* contents); |
| // Let others iterate over the list of background printing tabs. |
| - std::set<TabContentsWrapper*>::const_iterator begin(); |
| - std::set<TabContentsWrapper*>::const_iterator end(); |
| + TabContentsWrapperSet::const_iterator begin(); |
| + TabContentsWrapperSet::const_iterator end(); |
| // Returns true if |printing_contents_| contains |entry|. |
| - bool HasTabContents(TabContentsWrapper* entry); |
| + bool HasPreviewTabContents(TabContentsWrapper* entry); |
| // NotificationObserver overrides: |
| virtual void Observe(int type, |
| @@ -45,8 +58,25 @@ class BackgroundPrintingManager |
| const NotificationDetails& details) OVERRIDE; |
| private: |
| - // The set of tabs managed by BackgroundPrintingManager. |
| - std::set<TabContentsWrapper*> printing_contents_; |
| + |
| + // Called when the preview tab is going away to release the corresponding |
| + // initiator tab. Returns true when the initiator content was owned. |
| + bool ReleaseInitiatorForPreviewTabContents( |
| + TabContentsWrapper* preview_content); |
| + |
| + // Takes ownership of |content| in |wrapper_set| and deletes it when |
| + // |source_content| is destroyed by either being canceled, closed or finishing |
| + // printing. This removes the TabContentsWrapper from its TabStrip and hides |
| + // it from the user. |
| + void OwnTabContents(TabContentsWrapper* content, |
| + TabContentsWrapper* source_content, |
|
Lei Zhang
2011/08/27 01:05:06
I don't think you need to pass in |source_content|
|
| + TabContentsWrapperSet* wrapper_set); |
| + |
| + // The set of preview tabs managed by BackgroundPrintingManager. |
| + TabContentsWrapperSet printing_contents_; |
| + |
| + // The set of initiator tabs managed by BackgroundPrintingManager. |
| + TabContentsWrapperSet initiator_contents_; |
| NotificationRegistrar registrar_; |