| 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/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/sessions/session_id.h" | 12 #include "chrome/browser/sessions/session_id.h" |
| 12 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 14 | 15 |
| 15 class GURL; | 16 class GURL; |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 struct LoadCommittedDetails; | 19 struct LoadCommittedDetails; |
| 19 class RenderProcessHost; | 20 class RenderProcessHost; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 70 |
| 70 // Returns true if |contents| is a print preview dialog. | 71 // Returns true if |contents| is a print preview dialog. |
| 71 static bool IsPrintPreviewDialog(content::WebContents* contents); | 72 static bool IsPrintPreviewDialog(content::WebContents* contents); |
| 72 | 73 |
| 73 // Returns true if |url| is a print preview url. | 74 // Returns true if |url| is a print preview url. |
| 74 static bool IsPrintPreviewURL(const GURL& url); | 75 static bool IsPrintPreviewURL(const GURL& url); |
| 75 | 76 |
| 76 // Erase the initiator tab info associated with |preview_tab|. | 77 // Erase the initiator tab info associated with |preview_tab|. |
| 77 void EraseInitiatorTabInfo(content::WebContents* preview_tab); | 78 void EraseInitiatorTabInfo(content::WebContents* preview_tab); |
| 78 | 79 |
| 79 bool is_creating_print_preview_dialog() const; | 80 bool is_creating_print_preview_dialog() const { |
| 81 return is_creating_print_preview_dialog_; |
| 82 } |
| 83 |
| 84 void set_print_preview_tab_created_callback_for_testing( |
| 85 const base::Closure& callback) { |
| 86 print_preview_tab_created_callback_ = callback; |
| 87 } |
| 80 | 88 |
| 81 private: | 89 private: |
| 82 friend class base::RefCounted<PrintPreviewDialogController>; | 90 friend class base::RefCounted<PrintPreviewDialogController>; |
| 83 | 91 |
| 84 // 1:1 relationship between initiator tab and print preview tab. | 92 // 1:1 relationship between initiator tab and print preview tab. |
| 85 // Key: Preview tab. | 93 // Key: Preview tab. |
| 86 // Value: Initiator tab. | 94 // Value: Initiator tab. |
| 87 typedef std::map<content::WebContents*, content::WebContents*> | 95 typedef std::map<content::WebContents*, content::WebContents*> |
| 88 PrintPreviewTabMap; | 96 PrintPreviewTabMap; |
| 89 | 97 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 content::NotificationRegistrar registrar_; | 133 content::NotificationRegistrar registrar_; |
| 126 | 134 |
| 127 // True if the controller is waiting for a new preview tab via | 135 // True if the controller is waiting for a new preview tab via |
| 128 // content::NAVIGATION_TYPE_NEW_PAGE. | 136 // content::NAVIGATION_TYPE_NEW_PAGE. |
| 129 bool waiting_for_new_preview_page_; | 137 bool waiting_for_new_preview_page_; |
| 130 | 138 |
| 131 // Whether the PrintPreviewDialogController is in the middle of creating a | 139 // Whether the PrintPreviewDialogController is in the middle of creating a |
| 132 // print preview dialog. | 140 // print preview dialog. |
| 133 bool is_creating_print_preview_dialog_; | 141 bool is_creating_print_preview_dialog_; |
| 134 | 142 |
| 143 base::Closure print_preview_tab_created_callback_; |
| 144 |
| 135 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogController); | 145 DISALLOW_COPY_AND_ASSIGN(PrintPreviewDialogController); |
| 136 }; | 146 }; |
| 137 | 147 |
| 138 } // namespace printing | 148 } // namespace printing |
| 139 | 149 |
| 140 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_ | 150 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_DIALOG_CONTROLLER_H_ |
| OLD | NEW |