Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ |
| 6 #define CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ | 6 #define CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 class BackgroundPrintingManager | 23 class BackgroundPrintingManager |
| 24 : public base::NonThreadSafe, | 24 : public base::NonThreadSafe, |
| 25 public NotificationObserver { | 25 public NotificationObserver { |
| 26 public: | 26 public: |
| 27 BackgroundPrintingManager(); | 27 BackgroundPrintingManager(); |
| 28 virtual ~BackgroundPrintingManager(); | 28 virtual ~BackgroundPrintingManager(); |
| 29 | 29 |
| 30 // Takes ownership of |content| and deletes it when |content| finishes | 30 // Takes ownership of |content| and deletes it when |content| finishes |
| 31 // printing. This removes the TabContentsWrapper from its TabStrip and | 31 // printing. This removes the TabContentsWrapper from its TabStrip and |
| 32 // hides it from the user. | 32 // hides it from the user. |
| 33 void OwnTabContents(TabContentsWrapper* content); | 33 void OwnPreviewTabContents(TabContentsWrapper* content); |
| 34 | |
| 35 // Takes ownership of |content| and deletes it when its preview tab is | |
| 36 // destroyed by either being canceled, closed or finishing printing. This | |
| 37 // removes the TabContentsWrapper from its TabStrip and hides it from the | |
| 38 // user. | |
| 39 // Returns true if content has an associated print preview tab. | |
| 40 bool OwnInitiatorTabContents(TabContentsWrapper* content); | |
| 41 | |
| 42 // Called when we no longer need to access the initiator tab, deletes if | |
| 43 // currently owned. Returns true when |content| was owned. | |
| 44 bool ReleaseInitiatorTabContents(TabContentsWrapper* content); | |
| 34 | 45 |
| 35 // Let others iterate over the list of background printing tabs. | 46 // Let others iterate over the list of background printing tabs. |
| 36 std::set<TabContentsWrapper*>::const_iterator begin(); | 47 std::set<TabContentsWrapper*>::const_iterator begin(); |
| 37 std::set<TabContentsWrapper*>::const_iterator end(); | 48 std::set<TabContentsWrapper*>::const_iterator end(); |
| 38 | 49 |
| 39 // Returns true if |printing_contents_| contains |entry|. | 50 // Returns true if |printing_contents_| contains |entry|. |
| 40 bool HasTabContents(TabContentsWrapper* entry); | 51 bool HasTabContents(TabContentsWrapper* entry); |
| 41 | 52 |
| 42 // NotificationObserver overrides: | 53 // NotificationObserver overrides: |
| 43 virtual void Observe(int type, | 54 virtual void Observe(int type, |
| 44 const NotificationSource& source, | 55 const NotificationSource& source, |
| 45 const NotificationDetails& details) OVERRIDE; | 56 const NotificationDetails& details) OVERRIDE; |
| 46 | 57 |
| 47 private: | 58 private: |
| 59 // Takes ownership of |content| and deletes it when its preview tab is | |
| 60 // destroyed by either being canceled, closed or finishing printing. This | |
| 61 // removes the TabContentsWrapper from its TabStrip and hides it from the | |
| 62 // user. | |
| 63 void OwnTabContents(TabContentsWrapper* content, | |
| 64 TabContentsWrapper* source_content); | |
| 65 | |
| 48 // The set of tabs managed by BackgroundPrintingManager. | 66 // The set of tabs managed by BackgroundPrintingManager. |
| 49 std::set<TabContentsWrapper*> printing_contents_; | 67 std::set<TabContentsWrapper*> printing_contents_; |
| 50 | 68 |
|
Lei Zhang
2011/08/11 09:47:16
If you add a second set for the initiator tabs we
Sheridan Rawlins
2011/08/16 06:11:54
Done.
| |
| 51 NotificationRegistrar registrar_; | 69 NotificationRegistrar registrar_; |
| 52 | 70 |
| 53 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); | 71 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); |
| 54 }; | 72 }; |
| 55 | 73 |
| 56 } // namespace printing | 74 } // namespace printing |
| 57 | 75 |
| 58 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ | 76 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ |
| OLD | NEW |