| 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // Initiate print preview for |initiator_tab|. | 46 // Initiate print preview for |initiator_tab|. |
| 47 // Call this instead of GetOrCreatePreviewDialog(). | 47 // Call this instead of GetOrCreatePreviewDialog(). |
| 48 static void PrintPreview(content::WebContents* initiator_tab); | 48 static void PrintPreview(content::WebContents* initiator_tab); |
| 49 | 49 |
| 50 // Get/Create the print preview dialog for |initiator_tab|. | 50 // Get/Create the print preview dialog for |initiator_tab|. |
| 51 // Exposed for unit tests. | 51 // Exposed for unit tests. |
| 52 content::WebContents* GetOrCreatePreviewDialog( | 52 content::WebContents* GetOrCreatePreviewDialog( |
| 53 content::WebContents* initiator_tab); | 53 content::WebContents* initiator_tab); |
| 54 | 54 |
| 55 // DEPRECATED. Use GetOrCreatePreviewDialog() instead. | |
| 56 // TODO(thestig) Remove. | |
| 57 content::WebContents* GetOrCreatePreviewTab( | |
| 58 content::WebContents* initiator_tab); | |
| 59 | |
| 60 // Returns the preview dialog for |contents|. | 55 // Returns the preview dialog for |contents|. |
| 61 // Returns |contents| if |contents| is a preview dialog. | 56 // Returns |contents| if |contents| is a preview dialog. |
| 62 // Returns NULL if no preview dialog exists for |contents|. | 57 // Returns NULL if no preview dialog exists for |contents|. |
| 63 content::WebContents* GetPrintPreviewForContents( | 58 content::WebContents* GetPrintPreviewForContents( |
| 64 content::WebContents* contents) const; | 59 content::WebContents* contents) const; |
| 65 | 60 |
| 66 // DEPRECATED. Use GetPrintPreviewForContents() instead. | |
| 67 // TODO(thestig) Remove. | |
| 68 content::WebContents* GetPrintPreviewForTab(content::WebContents* tab) const; | |
| 69 | |
| 70 // Returns initiator tab for |preview_tab|. | 61 // Returns initiator tab for |preview_tab|. |
| 71 // Returns NULL if no initiator tab exists for |preview_tab|. | 62 // Returns NULL if no initiator tab exists for |preview_tab|. |
| 72 content::WebContents* GetInitiatorTab(content::WebContents* preview_tab); | 63 content::WebContents* GetInitiatorTab(content::WebContents* preview_tab); |
| 73 | 64 |
| 74 // content::NotificationObserver implementation. | 65 // content::NotificationObserver implementation. |
| 75 virtual void Observe(int type, | 66 virtual void Observe(int type, |
| 76 const content::NotificationSource& source, | 67 const content::NotificationSource& source, |
| 77 const content::NotificationDetails& details) OVERRIDE; | 68 const content::NotificationDetails& details) OVERRIDE; |
| 78 | 69 |
| 79 // Returns true if |contents| is a print preview dialog. | 70 // Returns true if |contents| is a print preview dialog. |
| 80 static bool IsPrintPreviewDialog(content::WebContents* contents); | 71 static bool IsPrintPreviewDialog(content::WebContents* contents); |
| 81 | 72 |
| 82 // DEPRECATED. Use IsPrintPreviewDialog() instead. | |
| 83 // TODO(thestig) Remove. | |
| 84 static bool IsPrintPreviewTab(content::WebContents* tab); | |
| 85 | |
| 86 // Returns true if |url| is a print preview url. | 73 // Returns true if |url| is a print preview url. |
| 87 static bool IsPrintPreviewURL(const GURL& url); | 74 static bool IsPrintPreviewURL(const GURL& url); |
| 88 | 75 |
| 89 // Erase the initiator tab info associated with |preview_tab|. | 76 // Erase the initiator tab info associated with |preview_tab|. |
| 90 void EraseInitiatorTabInfo(content::WebContents* preview_tab); | 77 void EraseInitiatorTabInfo(content::WebContents* preview_tab); |
| 91 | 78 |
| 92 bool is_creating_print_preview_dialog() const; | 79 bool is_creating_print_preview_dialog() const; |
| 93 | 80 |
| 94 private: | 81 private: |
| 95 friend class base::RefCounted<PrintPreviewDialogController>; | 82 friend class base::RefCounted<PrintPreviewDialogController>; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Whether the PrintPreviewDialogController is in the middle of creating a | 131 // Whether the PrintPreviewDialogController is in the middle of creating a |
| 145 // print preview dialog. | 132 // print preview dialog. |
| 146 bool is_creating_print_preview_dialog_; | 133 bool is_creating_print_preview_dialog_; |
| 147 | 134 |
| 148 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogController); | 135 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogController); |
| 149 }; | 136 }; |
| 150 | 137 |
| 151 } // namespace printing | 138 } // namespace printing |
| 152 | 139 |
| 153 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_ | 140 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_ |
| OLD | NEW |