Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: chrome/browser/printing/background_printing_manager.h

Issue 2442953002: Remove stl_util's deletion function use from chrome/. (Closed)
Patch Set: fix Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory>
9 #include <set> 10 #include <set>
10 11
11 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/non_thread_safe.h"
14 #include "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h" 16 #include "content/public/browser/notification_registrar.h"
16 17
17 namespace content { 18 namespace content {
18 class RenderProcessHost; 19 class RenderProcessHost;
19 class WebContents; 20 class WebContents;
20 } 21 }
21 22
22 namespace printing { 23 namespace printing {
23 24
24 // Manages hidden WebContents that prints documents in the background. 25 // Manages hidden WebContents that prints documents in the background.
25 // The hidden WebContents are no longer part of any Browser / TabStripModel. 26 // The hidden WebContents are no longer part of any Browser / TabStripModel.
26 // The WebContents started life as a ConstrainedWebDialog. 27 // The WebContents started life as a ConstrainedWebDialog.
27 // They get deleted when the printing finishes. 28 // They get deleted when the printing finishes.
28 class BackgroundPrintingManager : public base::NonThreadSafe, 29 class BackgroundPrintingManager : public base::NonThreadSafe,
29 public content::NotificationObserver { 30 public content::NotificationObserver {
30 public: 31 public:
31 class Observer; 32 class Observer;
32 typedef std::map<content::WebContents*, Observer*> WebContentsObserverMap;
33 33
34 BackgroundPrintingManager(); 34 BackgroundPrintingManager();
35 ~BackgroundPrintingManager() override; 35 ~BackgroundPrintingManager() override;
36 36
37 // Takes ownership of |preview_dialog| and deletes it when |preview_dialog| 37 // Takes ownership of |preview_dialog| and deletes it when |preview_dialog|
38 // finishes printing. This removes |preview_dialog| from its ConstrainedDialog 38 // finishes printing. This removes |preview_dialog| from its ConstrainedDialog
39 // and hides it from the user. 39 // and hides it from the user.
40 void OwnPrintPreviewDialog(content::WebContents* preview_dialog); 40 void OwnPrintPreviewDialog(content::WebContents* preview_dialog);
41 41
42 // Returns true if |printing_contents_map_| contains |preview_dialog|. 42 // Returns true if |printing_contents_map_| contains |preview_dialog|.
43 bool HasPrintPreviewDialog(content::WebContents* preview_dialog); 43 bool HasPrintPreviewDialog(content::WebContents* preview_dialog);
44 44
45 // Let others see the list of background printing contents. 45 // Let others see the list of background printing contents.
46 std::set<content::WebContents*> CurrentContentSet(); 46 std::set<content::WebContents*> CurrentContentSet();
47 47
48 private: 48 private:
49 // content::NotificationObserver overrides: 49 // content::NotificationObserver overrides:
50 void Observe(int type, 50 void Observe(int type,
51 const content::NotificationSource& source, 51 const content::NotificationSource& source,
52 const content::NotificationDetails& details) override; 52 const content::NotificationDetails& details) override;
53 53
54 // Schedule deletion of |preview_contents|. 54 // Schedule deletion of |preview_contents|.
55 void DeletePreviewContents(content::WebContents* preview_contents); 55 void DeletePreviewContents(content::WebContents* preview_contents);
56 56
57 // A map from print preview WebContentses (managed by 57 // A map from print preview WebContentses (managed by
58 // BackgroundPrintingManager) to the Observers that observe them. 58 // BackgroundPrintingManager) to the Observers that observe them.
59 WebContentsObserverMap printing_contents_map_; 59 std::map<content::WebContents*, std::unique_ptr<Observer>>
60 printing_contents_map_;
60 61
61 content::NotificationRegistrar registrar_; 62 content::NotificationRegistrar registrar_;
62 63
63 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); 64 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager);
64 }; 65 };
65 66
66 } // namespace printing 67 } // namespace printing
67 68
68 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ 69 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/plugins/plugin_observer.cc ('k') | chrome/browser/printing/background_printing_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698