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 // For print preview, a print preview (PP) tab is linked with the initiator tab | 5 // For print preview, a print preview (PP) tab is linked with the initiator tab |
6 // that initiated the printing operation. If the tab initiates a second | 6 // that initiated the printing operation. If the tab initiates a second |
7 // printing operation while the first print preview tab is still open, that PP | 7 // printing operation while the first print preview tab is still open, that PP |
8 // tab is focused/activated. There may be more than one PP tab open. There is a | 8 // tab is focused/activated. There may be more than one PP tab open. There is a |
9 // 1:1 relationship between PP tabs and initiating tabs. This class manages PP | 9 // 1:1 relationship between PP tabs and initiating tabs. This class manages PP |
10 // tabs and initiator tabs. | 10 // tabs and initiator tabs. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 TabContentsWrapper* CreatePrintPreviewTab(TabContentsWrapper* initiator_tab); | 97 TabContentsWrapper* CreatePrintPreviewTab(TabContentsWrapper* initiator_tab); |
98 | 98 |
99 // Helper function to store the initiator tab(title and url) information | 99 // Helper function to store the initiator tab(title and url) information |
100 // in PrintPreviewUI. | 100 // in PrintPreviewUI. |
101 void SetInitiatorTabURLAndTitle(TabContentsWrapper* preview_tab); | 101 void SetInitiatorTabURLAndTitle(TabContentsWrapper* preview_tab); |
102 | 102 |
103 // Adds/Removes observers for notifications from |tab|. | 103 // Adds/Removes observers for notifications from |tab|. |
104 void AddObservers(TabContentsWrapper* tab); | 104 void AddObservers(TabContentsWrapper* tab); |
105 void RemoveObservers(TabContentsWrapper* tab); | 105 void RemoveObservers(TabContentsWrapper* tab); |
106 | 106 |
107 // Removes tabs when they close/crash/navigate. | |
108 void RemoveInitiatorTab(TabContentsWrapper* initiator_tab); | |
109 void RemovePreviewTab(TabContentsWrapper* preview_tab); | |
110 | |
111 // Mapping between print preview tab and the corresponding initiator tab. | 107 // Mapping between print preview tab and the corresponding initiator tab. |
112 PrintPreviewTabMap preview_tab_map_; | 108 PrintPreviewTabMap preview_tab_map_; |
113 | 109 |
114 // A registrar for listening notifications. | 110 // A registrar for listening notifications. |
115 content::NotificationRegistrar registrar_; | 111 content::NotificationRegistrar registrar_; |
116 | 112 |
117 // True if the controller is waiting for a new preview tab via | 113 // True if the controller is waiting for a new preview tab via |
118 // content::NAVIGATION_TYPE_NEW_PAGE. | 114 // content::NAVIGATION_TYPE_NEW_PAGE. |
119 bool waiting_for_new_preview_page_; | 115 bool waiting_for_new_preview_page_; |
120 | 116 |
121 DISALLOW_COPY_AND_ASSIGN(PrintPreviewTabController); | 117 DISALLOW_COPY_AND_ASSIGN(PrintPreviewTabController); |
122 }; | 118 }; |
123 | 119 |
124 } // namespace printing | 120 } // namespace printing |
125 | 121 |
126 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ | 122 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ |
OLD | NEW |