OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PRINT_PREVIEW_DIALOG_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_ |
6 #define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_ | 6 #define CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Returns true if |url| is a print preview url. | 72 // Returns true if |url| is a print preview url. |
73 static bool IsPrintPreviewURL(const GURL& url); | 73 static bool IsPrintPreviewURL(const GURL& url); |
74 | 74 |
75 // Erase the initiator info associated with |preview_dialog|. | 75 // Erase the initiator info associated with |preview_dialog|. |
76 void EraseInitiatorInfo(content::WebContents* preview_dialog); | 76 void EraseInitiatorInfo(content::WebContents* preview_dialog); |
77 | 77 |
78 bool is_creating_print_preview_dialog() const { | 78 bool is_creating_print_preview_dialog() const { |
79 return is_creating_print_preview_dialog_; | 79 return is_creating_print_preview_dialog_; |
80 } | 80 } |
81 | 81 |
82 void AddProxyDialogForWebContents(content::WebContents* source, | |
83 content::WebContents* target); | |
84 | |
85 void RemoveProxyDialogForWebContents(content::WebContents* source); | |
86 | |
87 // Returns |source|'s |target| if it's a proxy, otherwise returns |source|. | |
88 content::WebContents* GetProxyDialogTarget( | |
89 content::WebContents* source) const; | |
90 | |
91 private: | 82 private: |
92 friend class base::RefCounted<PrintPreviewDialogController>; | 83 friend class base::RefCounted<PrintPreviewDialogController>; |
93 | 84 |
94 // 1:1 relationship between a print preview dialog and its initiator tab. | 85 // 1:1 relationship between a print preview dialog and its initiator tab. |
95 // Key: Print preview dialog. | 86 // Key: Print preview dialog. |
96 // Value: Initiator. | 87 // Value: Initiator. |
97 using PrintPreviewDialogMap = | 88 using PrintPreviewDialogMap = |
98 std::map<content::WebContents*, content::WebContents*>; | 89 std::map<content::WebContents*, content::WebContents*>; |
99 | 90 |
100 ~PrintPreviewDialogController() override; | 91 ~PrintPreviewDialogController() override; |
(...skipping 23 matching lines...) Expand all Loading... |
124 void AddObservers(content::WebContents* contents); | 115 void AddObservers(content::WebContents* contents); |
125 void RemoveObservers(content::WebContents* contents); | 116 void RemoveObservers(content::WebContents* contents); |
126 | 117 |
127 // Removes WebContents when they close/crash/navigate. | 118 // Removes WebContents when they close/crash/navigate. |
128 void RemoveInitiator(content::WebContents* initiator); | 119 void RemoveInitiator(content::WebContents* initiator); |
129 void RemovePreviewDialog(content::WebContents* preview_dialog); | 120 void RemovePreviewDialog(content::WebContents* preview_dialog); |
130 | 121 |
131 // Mapping between print preview dialog and the corresponding initiator. | 122 // Mapping between print preview dialog and the corresponding initiator. |
132 PrintPreviewDialogMap preview_dialog_map_; | 123 PrintPreviewDialogMap preview_dialog_map_; |
133 | 124 |
134 PrintPreviewDialogMap proxied_dialog_map_; | |
135 | |
136 // A registrar for listening to notifications. | 125 // A registrar for listening to notifications. |
137 content::NotificationRegistrar registrar_; | 126 content::NotificationRegistrar registrar_; |
138 | 127 |
139 // True if the controller is waiting for a new preview dialog via | 128 // True if the controller is waiting for a new preview dialog via |
140 // content::NAVIGATION_TYPE_NEW_PAGE. | 129 // content::NAVIGATION_TYPE_NEW_PAGE. |
141 bool waiting_for_new_preview_page_; | 130 bool waiting_for_new_preview_page_; |
142 | 131 |
143 // Whether the PrintPreviewDialogController is in the middle of creating a | 132 // Whether the PrintPreviewDialogController is in the middle of creating a |
144 // print preview dialog. | 133 // print preview dialog. |
145 bool is_creating_print_preview_dialog_; | 134 bool is_creating_print_preview_dialog_; |
146 | 135 |
147 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogController); | 136 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogController); |
148 }; | 137 }; |
149 | 138 |
150 } // namespace printing | 139 } // namespace printing |
151 | 140 |
152 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_ | 141 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_ |
OLD | NEW |