| 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_BACKGROUND_PRINTING_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ |
| 6 #define CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ | 6 #define CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // The hidden WebContents are no longer part of any Browser / TabStripModel. | 24 // The hidden WebContents are no longer part of any Browser / TabStripModel. |
| 25 // The WebContents started life as a ConstrainedWebDialog. | 25 // The WebContents started life as a ConstrainedWebDialog. |
| 26 // They get deleted when the printing finishes. | 26 // They get deleted when the printing finishes. |
| 27 class BackgroundPrintingManager : public base::NonThreadSafe, | 27 class BackgroundPrintingManager : public base::NonThreadSafe, |
| 28 public content::NotificationObserver { | 28 public content::NotificationObserver { |
| 29 public: | 29 public: |
| 30 class Observer; | 30 class Observer; |
| 31 typedef std::map<content::WebContents*, Observer*> WebContentsObserverMap; | 31 typedef std::map<content::WebContents*, Observer*> WebContentsObserverMap; |
| 32 | 32 |
| 33 BackgroundPrintingManager(); | 33 BackgroundPrintingManager(); |
| 34 virtual ~BackgroundPrintingManager(); | 34 ~BackgroundPrintingManager() override; |
| 35 | 35 |
| 36 // Takes ownership of |preview_dialog| and deletes it when |preview_dialog| | 36 // Takes ownership of |preview_dialog| and deletes it when |preview_dialog| |
| 37 // finishes printing. This removes |preview_dialog| from its ConstrainedDialog | 37 // finishes printing. This removes |preview_dialog| from its ConstrainedDialog |
| 38 // and hides it from the user. | 38 // and hides it from the user. |
| 39 void OwnPrintPreviewDialog(content::WebContents* preview_dialog); | 39 void OwnPrintPreviewDialog(content::WebContents* preview_dialog); |
| 40 | 40 |
| 41 // Returns true if |printing_contents_map_| contains |preview_dialog|. | 41 // Returns true if |printing_contents_map_| contains |preview_dialog|. |
| 42 bool HasPrintPreviewDialog(content::WebContents* preview_dialog); | 42 bool HasPrintPreviewDialog(content::WebContents* preview_dialog); |
| 43 | 43 |
| 44 // Let others see the list of background printing contents. | 44 // Let others see the list of background printing contents. |
| 45 std::set<content::WebContents*> CurrentContentSet(); | 45 std::set<content::WebContents*> CurrentContentSet(); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 // content::NotificationObserver overrides: | 48 // content::NotificationObserver overrides: |
| 49 virtual void Observe(int type, | 49 void Observe(int type, |
| 50 const content::NotificationSource& source, | 50 const content::NotificationSource& source, |
| 51 const content::NotificationDetails& details) override; | 51 const content::NotificationDetails& details) override; |
| 52 | 52 |
| 53 // Schedule deletion of |preview_contents|. | 53 // Schedule deletion of |preview_contents|. |
| 54 void DeletePreviewContents(content::WebContents* preview_contents); | 54 void DeletePreviewContents(content::WebContents* preview_contents); |
| 55 | 55 |
| 56 // A map from print preview WebContentses (managed by | 56 // A map from print preview WebContentses (managed by |
| 57 // BackgroundPrintingManager) to the Observers that observe them. | 57 // BackgroundPrintingManager) to the Observers that observe them. |
| 58 WebContentsObserverMap printing_contents_map_; | 58 WebContentsObserverMap printing_contents_map_; |
| 59 | 59 |
| 60 content::NotificationRegistrar registrar_; | 60 content::NotificationRegistrar registrar_; |
| 61 | 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); | 62 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace printing | 65 } // namespace printing |
| 66 | 66 |
| 67 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ | 67 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ |
| OLD | NEW |