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 <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 17 matching lines...) Expand all Loading... | |
28 typedef std::set<TabContentsWrapper*> TabContentsWrapperSet; | 28 typedef std::set<TabContentsWrapper*> TabContentsWrapperSet; |
29 | 29 |
30 BackgroundPrintingManager(); | 30 BackgroundPrintingManager(); |
31 virtual ~BackgroundPrintingManager(); | 31 virtual ~BackgroundPrintingManager(); |
32 | 32 |
33 // Takes ownership of |preview_tab| and deletes it when |preview_tab| finishes | 33 // Takes ownership of |preview_tab| and deletes it when |preview_tab| finishes |
34 // printing. This removes the TabContentsWrapper from its TabStrip and | 34 // printing. This removes the TabContentsWrapper from its TabStrip and |
35 // hides it from the user. | 35 // hides it from the user. |
36 void OwnPrintPreviewTab(TabContentsWrapper* preview_tab); | 36 void OwnPrintPreviewTab(TabContentsWrapper* preview_tab); |
37 | 37 |
38 // Takes ownership of |initiator_tab| and deletes it when its preview tab is | |
39 // destroyed by either being canceled, closed or finishing printing. This | |
40 // removes the TabContentsWrapper from its TabStrip and hides it from the | |
41 // user. Returns true if content has an associated print preview tab, | |
42 // otherwise, returns false and does not take ownership of |initiator_tab|. | |
43 bool OwnInitiatorTab(TabContentsWrapper* initiator_tab); | |
44 | |
45 // Let others iterate over the list of background printing tabs. | 38 // Let others iterate over the list of background printing tabs. |
46 TabContentsWrapperSet::const_iterator begin(); | 39 TabContentsWrapperSet::const_iterator begin(); |
47 TabContentsWrapperSet::const_iterator end(); | 40 TabContentsWrapperSet::const_iterator end(); |
48 | 41 |
49 // Returns true if |printing_tabs_| contains |preview_tab|. | 42 // Returns true if |printing_tabs_| contains |preview_tab|. |
50 bool HasPrintPreviewTab(TabContentsWrapper* preview_tab); | 43 bool HasPrintPreviewTab(TabContentsWrapper* preview_tab); |
51 | 44 |
52 // NotificationObserver overrides: | 45 // NotificationObserver overrides: |
53 virtual void Observe(int type, | 46 virtual void Observe(int type, |
54 const NotificationSource& source, | 47 const NotificationSource& source, |
55 const NotificationDetails& details) OVERRIDE; | 48 const NotificationDetails& details) OVERRIDE; |
56 | 49 |
57 private: | 50 private: |
58 typedef std::map<TabContentsWrapper*, TabContentsWrapper*> | 51 typedef std::map<TabContentsWrapper*, TabContentsWrapper*> |
59 TabContentsWrapperMap; | 52 TabContentsWrapperMap; |
kmadhusu
2011/10/13 18:52:18
You can delete this typedef.
Lei Zhang
2011/10/13 21:12:12
Done.
| |
60 | 53 |
61 // Notifications handlers. | 54 // Notifications handlers. |
62 void OnRendererProcessClosed(RenderProcessHost* rph); | 55 void OnRendererProcessClosed(RenderProcessHost* rph); |
63 void OnPrintJobReleased(TabContentsWrapper* preview_tab); | 56 void OnPrintJobReleased(TabContentsWrapper* preview_tab); |
64 void OnTabContentsDestroyed(TabContentsWrapper* preview_tab); | 57 void OnTabContentsDestroyed(TabContentsWrapper* preview_tab); |
65 | 58 |
66 // Removes |tab| from its tab strip. | |
67 void RemoveFromTabStrip(TabContentsWrapper* tab); | |
68 | |
69 // The set of print preview tabs managed by BackgroundPrintingManager. | 59 // The set of print preview tabs managed by BackgroundPrintingManager. |
70 TabContentsWrapperSet printing_tabs_; | 60 TabContentsWrapperSet printing_tabs_; |
71 | 61 |
72 // 1:1 mapping between an initiator tab managed by BackgroundPrintingManager | |
73 // and its associated print preview tab. The print preview tab need not be in | |
74 // |printing_tabs_|. | |
75 // Key: print preview tab. | |
76 // Value: initiator tab. | |
77 TabContentsWrapperMap map_; | |
78 | |
79 NotificationRegistrar registrar_; | 62 NotificationRegistrar registrar_; |
80 | 63 |
81 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); | 64 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); |
82 }; | 65 }; |
83 | 66 |
84 } // namespace printing | 67 } // namespace printing |
85 | 68 |
86 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ | 69 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ |
OLD | NEW |