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

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

Issue 8564044: Revert 110056 - Print Preview: Make print preview tab modal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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>
(...skipping 17 matching lines...) Expand all
28 typedef std::set<TabContentsWrapper*> TabContentsWrapperSet; 28 typedef std::set<TabContentsWrapper*> TabContentsWrapperSet;
29 29
30 BackgroundPrintingManager(); 30 BackgroundPrintingManager();
31 virtual ~BackgroundPrintingManager(); 31 virtual ~BackgroundPrintingManager();
32 32
33 // Takes ownership of |preview_tab| and deletes it when |preview_tab| finishes 33 // Takes ownership of |preview_tab| and deletes it when |preview_tab| finishes
34 // printing. This removes the TabContentsWrapper from its TabStrip and 34 // printing. This removes the TabContentsWrapper from its TabStrip and
35 // hides it from the user. 35 // hides it from the user.
36 void OwnPrintPreviewTab(TabContentsWrapper* preview_tab); 36 void OwnPrintPreviewTab(TabContentsWrapper* preview_tab);
37 37
38 // Takes ownership of |initiator_tab| and deletes it when its preview tab is
39 // destroyed by either being canceled, closed or finishing printing. This
40 // removes the TabContentsWrapper from its TabStrip and hides it from the
41 // user. Returns true if content has an associated print preview tab,
42 // otherwise, returns false and does not take ownership of |initiator_tab|.
43 bool OwnInitiatorTab(TabContentsWrapper* initiator_tab);
44
38 // Let others iterate over the list of background printing tabs. 45 // Let others iterate over the list of background printing tabs.
39 TabContentsWrapperSet::const_iterator begin(); 46 TabContentsWrapperSet::const_iterator begin();
40 TabContentsWrapperSet::const_iterator end(); 47 TabContentsWrapperSet::const_iterator end();
41 48
42 // Returns true if |printing_tabs_| contains |preview_tab|. 49 // Returns true if |printing_tabs_| contains |preview_tab|.
43 bool HasPrintPreviewTab(TabContentsWrapper* preview_tab); 50 bool HasPrintPreviewTab(TabContentsWrapper* preview_tab);
44 51
45 // content::NotificationObserver overrides: 52 // content::NotificationObserver overrides:
46 virtual void Observe(int type, 53 virtual void Observe(int type,
47 const content::NotificationSource& source, 54 const content::NotificationSource& source,
48 const content::NotificationDetails& details) OVERRIDE; 55 const content::NotificationDetails& details) OVERRIDE;
49 56
50 private: 57 private:
58 typedef std::map<TabContentsWrapper*, TabContentsWrapper*>
59 TabContentsWrapperMap;
60
51 // Notifications handlers. 61 // Notifications handlers.
52 void OnRendererProcessClosed(RenderProcessHost* rph); 62 void OnRendererProcessClosed(RenderProcessHost* rph);
53 void OnPrintJobReleased(TabContentsWrapper* preview_tab); 63 void OnPrintJobReleased(TabContentsWrapper* preview_tab);
54 void OnTabContentsDestroyed(TabContentsWrapper* preview_tab); 64 void OnTabContentsDestroyed(TabContentsWrapper* preview_tab);
55 65
66 // Removes |tab| from its tab strip.
67 void RemoveFromTabStrip(TabContentsWrapper* tab);
68
56 // Add |tab| to the pending deletion set and schedule deletion. 69 // Add |tab| to the pending deletion set and schedule deletion.
57 void DeletePreviewTab(TabContentsWrapper* tab); 70 void DeletePreviewTab(TabContentsWrapper* tab);
58 71
59 // Check if any of the TabContentsWrappers in |set| share a RenderProcessHost 72 // Check if any of the TabContentsWrappers in |set| share a RenderProcessHost
60 // with |tab|, excluding |tab|. 73 // with |tab|, excluding |tab|.
61 bool HasSharedRenderProcessHost(const TabContentsWrapperSet& set, 74 bool HasSharedRenderProcessHost(const TabContentsWrapperSet& set,
62 TabContentsWrapper* tab); 75 TabContentsWrapper* tab);
63 76
64 // The set of print preview tabs managed by BackgroundPrintingManager. 77 // The set of print preview tabs managed by BackgroundPrintingManager.
65 TabContentsWrapperSet printing_tabs_; 78 TabContentsWrapperSet printing_tabs_;
66 79
67 // The set of print preview tabs managed by BackgroundPrintingManager that 80 // The set of print preview tabs managed by BackgroundPrintingManager that
68 // are pending deletion. 81 // are pending deletion.
69 TabContentsWrapperSet printing_tabs_pending_deletion_; 82 TabContentsWrapperSet printing_tabs_pending_deletion_;
70 83
84 // 1:1 mapping between an initiator tab managed by BackgroundPrintingManager
85 // and its associated print preview tab. The print preview tab need not be in
86 // |printing_tabs_|.
87 // Key: print preview tab.
88 // Value: initiator tab.
89 TabContentsWrapperMap map_;
90
71 content::NotificationRegistrar registrar_; 91 content::NotificationRegistrar registrar_;
72 92
73 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); 93 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager);
74 }; 94 };
75 95
76 } // namespace printing 96 } // namespace printing
77 97
78 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ 98 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/printing/background_printing_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698