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. |
11 #ifndef CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ | 11 #ifndef CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ |
12 | 12 |
13 #define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ | 13 #define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ |
14 #pragma once | 14 #pragma once |
15 | 15 |
16 #include <map> | 16 #include <map> |
17 #include <vector> | |
kmadhusu
2011/10/13 18:52:18
Why do you need a vector here?
Lei Zhang
2011/10/13 21:12:12
Removed.
| |
17 | 18 |
18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
19 #include "chrome/browser/sessions/session_id.h" | 20 #include "chrome/browser/sessions/session_id.h" |
20 #include "content/common/notification_observer.h" | 21 #include "content/common/notification_observer.h" |
21 #include "content/common/notification_registrar.h" | 22 #include "content/common/notification_registrar.h" |
22 | 23 |
23 class Browser; | 24 class Browser; |
24 class GURL; | 25 class GURL; |
25 class RenderProcessHost; | 26 class RenderProcessHost; |
26 class TabContentsWrapper; | 27 class TabContentsWrapper; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 TabContentsWrapper* CreatePrintPreviewTab(TabContentsWrapper* initiator_tab); | 98 TabContentsWrapper* CreatePrintPreviewTab(TabContentsWrapper* initiator_tab); |
98 | 99 |
99 // Helper function to store the initiator tab(title and url) information | 100 // Helper function to store the initiator tab(title and url) information |
100 // in PrintPreviewUI. | 101 // in PrintPreviewUI. |
101 void SetInitiatorTabURLAndTitle(TabContentsWrapper* preview_tab); | 102 void SetInitiatorTabURLAndTitle(TabContentsWrapper* preview_tab); |
102 | 103 |
103 // Adds/Removes observers for notifications from |tab|. | 104 // Adds/Removes observers for notifications from |tab|. |
104 void AddObservers(TabContentsWrapper* tab); | 105 void AddObservers(TabContentsWrapper* tab); |
105 void RemoveObservers(TabContentsWrapper* tab); | 106 void RemoveObservers(TabContentsWrapper* tab); |
106 | 107 |
108 // Removes tabs when they close/crash/navigate. | |
109 void RemoveInitiatorTab(TabContentsWrapper* initiator_tab); | |
110 void RemovePreviewTab(TabContentsWrapper* preview_tab); | |
111 | |
107 // Mapping between print preview tab and the corresponding initiator tab. | 112 // Mapping between print preview tab and the corresponding initiator tab. |
108 PrintPreviewTabMap preview_tab_map_; | 113 PrintPreviewTabMap preview_tab_map_; |
109 | 114 |
110 // A registrar for listening notifications. | 115 // A registrar for listening notifications. |
111 NotificationRegistrar registrar_; | 116 NotificationRegistrar registrar_; |
112 | 117 |
113 // True if the controller is waiting for a new preview tab via | 118 // True if the controller is waiting for a new preview tab via |
114 // NavigationType::NEW_PAGE. | 119 // NavigationType::NEW_PAGE. |
115 bool waiting_for_new_preview_page_; | 120 bool waiting_for_new_preview_page_; |
116 | 121 |
117 DISALLOW_COPY_AND_ASSIGN(PrintPreviewTabController); | 122 DISALLOW_COPY_AND_ASSIGN(PrintPreviewTabController); |
118 }; | 123 }; |
119 | 124 |
120 } // namespace printing | 125 } // namespace printing |
121 | 126 |
122 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ | 127 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ |
OLD | NEW |