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 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: Address Kausalya's comments. 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);
Lei Zhang 2011/08/19 19:00:23 You might want to say it does not take ownership i
Sheridan Rawlins 2011/08/25 22:52:55 Done.
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.
Lei Zhang 2011/08/19 19:00:23 are these used anywhere?
Sheridan Rawlins 2011/08/25 22:52:55 No; removed. On 2011/08/19 19:00:23, Lei Zhang wr
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|.
Lei Zhang 2011/08/19 19:00:23 also not used anywhere?
Sheridan Rawlins 2011/08/25 22:52:55 Removed. On 2011/08/19 19:00:23, Lei Zhang wrote:
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 // Called when the preview tab is going away to release the corresponding
69 // initiator tab.
70 bool ReleaseInitiatorForPreviewTabContents(
71 TabContentsWrapper* preview_content);
72
73 // Takes ownership of |content| and deletes it when its preview tab is
74 // destroyed by either being canceled, closed or finishing printing. This
75 // removes the TabContentsWrapper from its TabStrip and hides it from the
76 // user.
77 void OwnTabContents(TabContentsWrapper* content,
78 TabContentsWrapper* source_content,
Lei Zhang 2011/08/19 19:00:23 document |source_content|
Sheridan Rawlins 2011/08/25 22:52:55 Done.
79 TabContentsWrapperSet* wrapper_set);
80
48 // The set of tabs managed by BackgroundPrintingManager. 81 // The set of tabs managed by BackgroundPrintingManager.
49 std::set<TabContentsWrapper*> printing_contents_; 82 std::set<TabContentsWrapper*> printing_contents_;
50 83
84 // The set of tabs managed by BackgroundPrintingManager.
85 std::set<TabContentsWrapper*> initiator_contents_;
Lei Zhang 2011/08/19 19:00:23 change these to TabContentsWrapperSet since you de
Sheridan Rawlins 2011/08/25 22:52:55 Done.
86
51 NotificationRegistrar registrar_; 87 NotificationRegistrar registrar_;
52 88
53 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager); 89 DISALLOW_COPY_AND_ASSIGN(BackgroundPrintingManager);
54 }; 90 };
55 91
56 } // namespace printing 92 } // namespace printing
57 93
58 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_ 94 #endif // CHROME_BROWSER_PRINTING_BACKGROUND_PRINTING_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698