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 | 17 |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "chrome/browser/sessions/session_id.h" | 19 #include "chrome/browser/sessions/session_id.h" |
20 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
22 | 22 |
23 class GURL; | 23 class GURL; |
24 class RenderProcessHost; | |
25 class TabContentsWrapper; | 24 class TabContentsWrapper; |
26 | 25 |
27 namespace content { | 26 namespace content { |
28 struct LoadCommittedDetails; | 27 struct LoadCommittedDetails; |
| 28 class RenderProcessHost; |
29 } | 29 } |
30 | 30 |
31 namespace printing { | 31 namespace printing { |
32 | 32 |
33 class PrintPreviewTabController | 33 class PrintPreviewTabController |
34 : public base::RefCounted<PrintPreviewTabController>, | 34 : public base::RefCounted<PrintPreviewTabController>, |
35 public content::NotificationObserver { | 35 public content::NotificationObserver { |
36 public: | 36 public: |
37 PrintPreviewTabController(); | 37 PrintPreviewTabController(); |
38 | 38 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 private: | 76 private: |
77 friend class base::RefCounted<PrintPreviewTabController>; | 77 friend class base::RefCounted<PrintPreviewTabController>; |
78 | 78 |
79 // 1:1 relationship between initiator tab and print preview tab. | 79 // 1:1 relationship between initiator tab and print preview tab. |
80 // Key: Preview tab. | 80 // Key: Preview tab. |
81 // Value: Initiator tab. | 81 // Value: Initiator tab. |
82 typedef std::map<TabContentsWrapper*, TabContentsWrapper*> PrintPreviewTabMap; | 82 typedef std::map<TabContentsWrapper*, TabContentsWrapper*> PrintPreviewTabMap; |
83 | 83 |
84 // Handler for the RENDERER_PROCESS_CLOSED notification. This is observed when | 84 // Handler for the RENDERER_PROCESS_CLOSED notification. This is observed when |
85 // the initiator renderer crashed. | 85 // the initiator renderer crashed. |
86 void OnRendererProcessClosed(RenderProcessHost* rph); | 86 void OnRendererProcessClosed(content::RenderProcessHost* rph); |
87 | 87 |
88 // Handler for the TAB_CONTENTS_DESTROYED notification. This is observed when | 88 // Handler for the TAB_CONTENTS_DESTROYED notification. This is observed when |
89 // either tab is closed. | 89 // either tab is closed. |
90 void OnTabContentsDestroyed(TabContentsWrapper* tab); | 90 void OnTabContentsDestroyed(TabContentsWrapper* tab); |
91 | 91 |
92 // Handler for the NAV_ENTRY_COMMITTED notification. This is observed when the | 92 // Handler for the NAV_ENTRY_COMMITTED notification. This is observed when the |
93 // renderer is navigated to a different page. | 93 // renderer is navigated to a different page. |
94 void OnNavEntryCommitted(TabContentsWrapper* tab, | 94 void OnNavEntryCommitted(TabContentsWrapper* tab, |
95 content::LoadCommittedDetails* details); | 95 content::LoadCommittedDetails* details); |
96 | 96 |
(...skipping 25 matching lines...) Expand all Loading... |
122 // Whether the PrintPreviewTabController is in the middle of creating a | 122 // Whether the PrintPreviewTabController is in the middle of creating a |
123 // print preview tab. | 123 // print preview tab. |
124 bool is_creating_print_preview_tab_; | 124 bool is_creating_print_preview_tab_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(PrintPreviewTabController); | 126 DISALLOW_COPY_AND_ASSIGN(PrintPreviewTabController); |
127 }; | 127 }; |
128 | 128 |
129 } // namespace printing | 129 } // namespace printing |
130 | 130 |
131 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ | 131 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ |
OLD | NEW |