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 // 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 TabContents* GetInitiatorTab(TabContents* preview_tab); | 53 TabContents* GetInitiatorTab(TabContents* preview_tab); |
| 54 | 54 |
| 55 // Notification observer implementation. | 55 // Notification observer implementation. |
| 56 virtual void Observe(NotificationType type, | 56 virtual void Observe(NotificationType type, |
| 57 const NotificationSource& source, | 57 const NotificationSource& source, |
| 58 const NotificationDetails& details); | 58 const NotificationDetails& details); |
| 59 | 59 |
| 60 // Returns true if |tab| is a print preview tab. | 60 // Returns true if |tab| is a print preview tab. |
| 61 static bool IsPrintPreviewTab(TabContents* tab); | 61 static bool IsPrintPreviewTab(TabContents* tab); |
| 62 | 62 |
| 63 // Erase the initiator tab info associated with |preview_tab|. | |
| 64 void EraseInitiatorTabInfo(TabContents* preview_tab); | |
|
Lei Zhang
2011/06/09 09:54:55
Can we add a unit test for this? Should be easy.
kmadhusu
2011/06/09 18:11:44
Done.
| |
| 65 | |
| 63 private: | 66 private: |
| 64 friend class base::RefCounted<PrintPreviewTabController>; | 67 friend class base::RefCounted<PrintPreviewTabController>; |
| 65 | 68 |
| 66 // 1:1 relationship between initiator tab and print preview tab. | 69 // 1:1 relationship between initiator tab and print preview tab. |
| 67 // Key: Preview tab. | 70 // Key: Preview tab. |
| 68 // Value: Initiator tab. | 71 // Value: Initiator tab. |
| 69 typedef std::map<TabContents*, TabContents*> PrintPreviewTabMap; | 72 typedef std::map<TabContents*, TabContents*> PrintPreviewTabMap; |
| 70 | 73 |
| 71 // Creates a new print preview tab. | 74 // Creates a new print preview tab. |
| 72 TabContents* CreatePrintPreviewTab(TabContents* initiator_tab); | 75 TabContents* CreatePrintPreviewTab(TabContents* initiator_tab); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 83 // True if the controller is waiting for a new preview tab via | 86 // True if the controller is waiting for a new preview tab via |
| 84 // NavigationType::NEW_PAGE. | 87 // NavigationType::NEW_PAGE. |
| 85 bool waiting_for_new_preview_page_; | 88 bool waiting_for_new_preview_page_; |
| 86 | 89 |
| 87 DISALLOW_COPY_AND_ASSIGN(PrintPreviewTabController); | 90 DISALLOW_COPY_AND_ASSIGN(PrintPreviewTabController); |
| 88 }; | 91 }; |
| 89 | 92 |
| 90 } // namespace printing | 93 } // namespace printing |
| 91 | 94 |
| 92 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ | 95 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ |
| OLD | NEW |