| 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/basictypes.h" | 10 #include "base/basictypes.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 |
| 82 private: | 87 private: |
| 83 friend class base::RefCounted<PrintPreviewDialogController>; | 88 friend class base::RefCounted<PrintPreviewDialogController>; |
| 84 | 89 |
| 85 // 1:1 relationship between a print preview dialog and its initiator tab. | 90 // 1:1 relationship between a print preview dialog and its initiator tab. |
| 86 // Key: Print preview dialog. | 91 // Key: Print preview dialog. |
| 87 // Value: Initiator. | 92 // Value: Initiator. |
| 88 typedef std::map<content::WebContents*, content::WebContents*> | 93 typedef std::map<content::WebContents*, content::WebContents*> |
| 89 PrintPreviewDialogMap; | 94 PrintPreviewDialogMap; |
| 90 | 95 |
| 91 ~PrintPreviewDialogController() override; | 96 ~PrintPreviewDialogController() override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 115 void AddObservers(content::WebContents* contents); | 120 void AddObservers(content::WebContents* contents); |
| 116 void RemoveObservers(content::WebContents* contents); | 121 void RemoveObservers(content::WebContents* contents); |
| 117 | 122 |
| 118 // Removes WebContents when they close/crash/navigate. | 123 // Removes WebContents when they close/crash/navigate. |
| 119 void RemoveInitiator(content::WebContents* initiator); | 124 void RemoveInitiator(content::WebContents* initiator); |
| 120 void RemovePreviewDialog(content::WebContents* preview_dialog); | 125 void RemovePreviewDialog(content::WebContents* preview_dialog); |
| 121 | 126 |
| 122 // Mapping between print preview dialog and the corresponding initiator. | 127 // Mapping between print preview dialog and the corresponding initiator. |
| 123 PrintPreviewDialogMap preview_dialog_map_; | 128 PrintPreviewDialogMap preview_dialog_map_; |
| 124 | 129 |
| 130 PrintPreviewDialogMap proxied_dialog_map_; |
| 131 |
| 125 // A registrar for listening to notifications. | 132 // A registrar for listening to notifications. |
| 126 content::NotificationRegistrar registrar_; | 133 content::NotificationRegistrar registrar_; |
| 127 | 134 |
| 128 // True if the controller is waiting for a new preview dialog via | 135 // True if the controller is waiting for a new preview dialog via |
| 129 // content::NAVIGATION_TYPE_NEW_PAGE. | 136 // content::NAVIGATION_TYPE_NEW_PAGE. |
| 130 bool waiting_for_new_preview_page_; | 137 bool waiting_for_new_preview_page_; |
| 131 | 138 |
| 132 // Whether the PrintPreviewDialogController is in the middle of creating a | 139 // Whether the PrintPreviewDialogController is in the middle of creating a |
| 133 // print preview dialog. | 140 // print preview dialog. |
| 134 bool is_creating_print_preview_dialog_; | 141 bool is_creating_print_preview_dialog_; |
| 135 | 142 |
| 136 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogController); | 143 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogController); |
| 137 }; | 144 }; |
| 138 | 145 |
| 139 } // namespace printing | 146 } // namespace printing |
| 140 | 147 |
| 141 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_ | 148 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_ |
| OLD | NEW |