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

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

Issue 10535045: TabContentsWrapper -> TabContents, for printing code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/printing/background_printing_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
14 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
16 16
17 class TabContents; 17 class TabContents;
18 typedef TabContents TabContentsWrapper;
19 18
20 namespace content { 19 namespace content {
21 class RenderProcessHost; 20 class RenderProcessHost;
22 } 21 }
23 22
24 namespace printing { 23 namespace printing {
25 24
26 // Manages hidden tabs that prints documents in the background. 25 // Manages hidden tabs that prints documents in the background.
27 // The hidden tabs are no longer part of any Browser / TabStripModel. 26 // The hidden tabs are no longer part of any Browser / TabStripModel.
28 // They get deleted when the tab finishes printing. 27 // They get deleted when the tab finishes printing.
29 class BackgroundPrintingManager : public base::NonThreadSafe, 28 class BackgroundPrintingManager : public base::NonThreadSafe,
30 public content::NotificationObserver { 29 public content::NotificationObserver {
31 public: 30 public:
32 typedef std::set<TabContentsWrapper*> TabContentsWrapperSet; 31 typedef std::set<TabContents*> TabContentsSet;
33 32
34 BackgroundPrintingManager(); 33 BackgroundPrintingManager();
35 virtual ~BackgroundPrintingManager(); 34 virtual ~BackgroundPrintingManager();
36 35
37 // Takes ownership of |preview_tab| and deletes it when |preview_tab| finishes 36 // Takes ownership of |preview_tab| and deletes it when |preview_tab| finishes
38 // printing. This removes the TabContentsWrapper from its TabStrip and 37 // printing. This removes the TabContents from its TabStrip and hides it from
39 // hides it from the user. 38 // the user.
40 void OwnPrintPreviewTab(TabContentsWrapper* preview_tab); 39 void OwnPrintPreviewTab(TabContents* preview_tab);
41 40
42 // Let others iterate over the list of background printing tabs. 41 // Let others iterate over the list of background printing tabs.
43 TabContentsWrapperSet::const_iterator begin(); 42 TabContentsSet::const_iterator begin();
44 TabContentsWrapperSet::const_iterator end(); 43 TabContentsSet::const_iterator end();
45 44
46 // Returns true if |printing_tabs_| contains |preview_tab|. 45 // Returns true if |printing_tabs_| contains |preview_tab|.
47 bool HasPrintPreviewTab(TabContentsWrapper* preview_tab); 46 bool HasPrintPreviewTab(TabContents* preview_tab);
48 47
49 // content::NotificationObserver overrides: 48 // content::NotificationObserver overrides:
50 virtual void Observe(int type, 49 virtual void Observe(int type,
51 const content::NotificationSource& source, 50 const content::NotificationSource& source,
52 const content::NotificationDetails& details) OVERRIDE; 51 const content::NotificationDetails& details) OVERRIDE;
53 52
54 private: 53 private:
55 // Notifications handlers. 54 // Notifications handlers.
56 void OnRendererProcessClosed(content::RenderProcessHost* rph); 55 void OnRendererProcessClosed(content::RenderProcessHost* rph);
57 void OnPrintJobReleased(TabContentsWrapper* preview_tab); 56 void OnPrintJobReleased(TabContents* preview_tab);
58 void OnTabContentsDestroyed(TabContentsWrapper* preview_tab); 57 void OnTabContentsDestroyed(TabContents* preview_tab);
59 58
60 // Add |tab| to the pending deletion set and schedule deletion. 59 // Add |tab| to the pending deletion set and schedule deletion.
61 void DeletePreviewTab(TabContentsWrapper* tab); 60 void DeletePreviewTab(TabContents* tab);
62 61
63 // Check if any of the TabContentsWrappers in |set| share a RenderProcessHost 62 // Check if any of the TabContents in |set| share a RenderProcessHost
64 // with |tab|, excluding |tab|. 63 // with |tab|, excluding |tab|.
65 bool HasSharedRenderProcessHost(const TabContentsWrapperSet& set, 64 bool HasSharedRenderProcessHost(const TabContentsSet& set,
66 TabContentsWrapper* tab); 65 TabContents* tab);
67 66
68 // The set of print preview tabs managed by BackgroundPrintingManager. 67 // The set of print preview tabs managed by BackgroundPrintingManager.
69 TabContentsWrapperSet printing_tabs_; 68 TabContentsSet printing_tabs_;
70 69
71 // The set of print preview tabs managed by BackgroundPrintingManager that 70 // The set of print preview tabs managed by BackgroundPrintingManager that
72 // are pending deletion. 71 // are pending deletion.
73 TabContentsWrapperSet printing_tabs_pending_deletion_; 72 TabContentsSet printing_tabs_pending_deletion_;
74 73
75 content::NotificationRegistrar registrar_; 74 content::NotificationRegistrar registrar_;
76 75
77 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); 76 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager);
78 }; 77 };
79 78
80 } // namespace printing 79 } // namespace printing
81 80
82 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ 81 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/printing/background_printing_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698