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

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

Issue 7574002: Be able to print items that do window.print(); window.close() (airline tix e.g.) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + Release initiator when preview tab is closed. Created 9 years, 4 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
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 <set> 9 #include <set>
10 10
(...skipping 12 matching lines...) Expand all
23 class BackgroundPrintingManager 23 class BackgroundPrintingManager
24 : public base::NonThreadSafe, 24 : public base::NonThreadSafe,
25 public NotificationObserver { 25 public NotificationObserver {
26 public: 26 public:
27 BackgroundPrintingManager(); 27 BackgroundPrintingManager();
28 virtual ~BackgroundPrintingManager(); 28 virtual ~BackgroundPrintingManager();
29 29
30 // Takes ownership of |content| and deletes it when |content| finishes 30 // Takes ownership of |content| and deletes it when |content| finishes
31 // printing. This removes the TabContentsWrapper from its TabStrip and 31 // printing. This removes the TabContentsWrapper from its TabStrip and
32 // hides it from the user. 32 // hides it from the user.
33 void OwnTabContents(TabContentsWrapper* content); 33 void OwnPreviewTabContents(TabContentsWrapper* content);
34
35 // Takes ownership of |content| and deletes it when its preview tab is
36 // destroyed by either being canceled, closed or finishing printing. This
37 // removes the TabContentsWrapper from its TabStrip and hides it from the
38 // user.
39 // Returns true if content has an associated print preview tab.
40 bool OwnInitiatorTabContents(TabContentsWrapper* content);
41
42 // Called when we no longer need to access the initiator tab, deletes if
43 // currently owned. Returns true when |content| was owned.
44 bool ReleaseInitiatorTabContents(TabContentsWrapper* content);
34 45
35 // Let others iterate over the list of background printing tabs. 46 // Let others iterate over the list of background printing tabs.
36 std::set<TabContentsWrapper*>::const_iterator begin(); 47 std::set<TabContentsWrapper*>::const_iterator begin();
37 std::set<TabContentsWrapper*>::const_iterator end(); 48 std::set<TabContentsWrapper*>::const_iterator end();
38 49
50 // Let others iterate over the list of background initiator tabs.
51 std::set<TabContentsWrapper*>::const_iterator begin_initiator();
52 std::set<TabContentsWrapper*>::const_iterator end_initiator();
53
39 // Returns true if |printing_contents_| contains |entry|. 54 // Returns true if |printing_contents_| contains |entry|.
40 bool HasTabContents(TabContentsWrapper* entry); 55 bool HasTabContents(TabContentsWrapper* entry);
41 56
57 // Returns true if |initiator_contents_| contains |entry|.
58 bool HasInitiatorTabContents(TabContentsWrapper* entry);
59
42 // NotificationObserver overrides: 60 // NotificationObserver overrides:
43 virtual void Observe(int type, 61 virtual void Observe(int type,
44 const NotificationSource& source, 62 const NotificationSource& source,
45 const NotificationDetails& details) OVERRIDE; 63 const NotificationDetails& details) OVERRIDE;
46 64
47 private: 65 private:
66 typedef std::set<TabContentsWrapper*> TabContentsWrapperSet;
67
68 // Takes ownership of |content| and deletes it when its preview tab is
69 // destroyed by either being canceled, closed or finishing printing. This
70 // removes the TabContentsWrapper from its TabStrip and hides it from the
71 // user.
72 void OwnTabContents(TabContentsWrapper* content,
73 TabContentsWrapper* source_content,
74 TabContentsWrapperSet* wrapper_set);
75
48 // The set of tabs managed by BackgroundPrintingManager. 76 // The set of tabs managed by BackgroundPrintingManager.
49 std::set<TabContentsWrapper*> printing_contents_; 77 std::set<TabContentsWrapper*> printing_contents_;
50 78
79 // The set of tabs managed by BackgroundPrintingManager.
80 std::set<TabContentsWrapper*> initiator_contents_;
81
51 NotificationRegistrar registrar_; 82 NotificationRegistrar registrar_;
52 83
53 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); 84 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager);
54 }; 85 };
55 86
56 } // namespace printing 87 } // namespace printing
57 88
58 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ 89 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698