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

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

Issue 8520011: Print Preview: Make print preview tab modal. (try 2) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: disable tests in touch_ui, fix failing test 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 // For print preview, a print preview (PP) tab is linked with the initiator tab 5 // For print preview, a print preview (PP) tab is linked with the initiator tab
6 // that initiated the printing operation. If the tab initiates a second 6 // that initiated the printing operation. If the tab initiates a second
7 // printing operation while the first print preview tab is still open, that PP 7 // printing operation while the first print preview tab is still open, that PP
8 // tab is focused/activated. There may be more than one PP tab open. There is a 8 // tab is focused/activated. There may be more than one PP tab open. There is a
9 // 1:1 relationship between PP tabs and initiating tabs. This class manages PP 9 // 1:1 relationship between PP tabs and initiating tabs. This class manages PP
10 // tabs and initiator tabs. 10 // tabs and initiator tabs.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 // Returns true if |tab| is a print preview tab. 66 // Returns true if |tab| is a print preview tab.
67 static bool IsPrintPreviewTab(TabContentsWrapper* tab); 67 static bool IsPrintPreviewTab(TabContentsWrapper* tab);
68 68
69 // Returns true if |url| is a print preview url. 69 // Returns true if |url| is a print preview url.
70 static bool IsPrintPreviewURL(const GURL& url); 70 static bool IsPrintPreviewURL(const GURL& url);
71 71
72 // Erase the initiator tab info associated with |preview_tab|. 72 // Erase the initiator tab info associated with |preview_tab|.
73 void EraseInitiatorTabInfo(TabContentsWrapper* preview_tab); 73 void EraseInitiatorTabInfo(TabContentsWrapper* preview_tab);
74 74
75 bool is_creating_print_preview_tab() const;
76
75 private: 77 private:
76 friend class base::RefCounted<PrintPreviewTabController>; 78 friend class base::RefCounted<PrintPreviewTabController>;
77 79
78 // 1:1 relationship between initiator tab and print preview tab. 80 // 1:1 relationship between initiator tab and print preview tab.
79 // Key: Preview tab. 81 // Key: Preview tab.
80 // Value: Initiator tab. 82 // Value: Initiator tab.
81 typedef std::map<TabContentsWrapper*, TabContentsWrapper*> PrintPreviewTabMap; 83 typedef std::map<TabContentsWrapper*, TabContentsWrapper*> PrintPreviewTabMap;
82 84
83 // Handler for the RENDERER_PROCESS_CLOSED notification. This is observed when 85 // Handler for the RENDERER_PROCESS_CLOSED notification. This is observed when
84 // the initiator renderer crashed. 86 // the initiator renderer crashed.
(...skipping 12 matching lines...) Expand all
97 TabContentsWrapper* CreatePrintPreviewTab(TabContentsWrapper* initiator_tab); 99 TabContentsWrapper* CreatePrintPreviewTab(TabContentsWrapper* initiator_tab);
98 100
99 // Helper function to store the initiator tab(title and url) information 101 // Helper function to store the initiator tab(title and url) information
100 // in PrintPreviewUI. 102 // in PrintPreviewUI.
101 void SetInitiatorTabURLAndTitle(TabContentsWrapper* preview_tab); 103 void SetInitiatorTabURLAndTitle(TabContentsWrapper* preview_tab);
102 104
103 // Adds/Removes observers for notifications from |tab|. 105 // Adds/Removes observers for notifications from |tab|.
104 void AddObservers(TabContentsWrapper* tab); 106 void AddObservers(TabContentsWrapper* tab);
105 void RemoveObservers(TabContentsWrapper* tab); 107 void RemoveObservers(TabContentsWrapper* tab);
106 108
109 // Removes tabs when they close/crash/navigate.
110 void RemoveInitiatorTab(TabContentsWrapper* initiator_tab);
111 void RemovePreviewTab(TabContentsWrapper* preview_tab);
112
107 // Mapping between print preview tab and the corresponding initiator tab. 113 // Mapping between print preview tab and the corresponding initiator tab.
108 PrintPreviewTabMap preview_tab_map_; 114 PrintPreviewTabMap preview_tab_map_;
109 115
110 // A registrar for listening notifications. 116 // A registrar for listening notifications.
111 content::NotificationRegistrar registrar_; 117 content::NotificationRegistrar registrar_;
112 118
113 // True if the controller is waiting for a new preview tab via 119 // True if the controller is waiting for a new preview tab via
114 // content::NAVIGATION_TYPE_NEW_PAGE. 120 // content::NAVIGATION_TYPE_NEW_PAGE.
115 bool waiting_for_new_preview_page_; 121 bool waiting_for_new_preview_page_;
116 122
123 // Whether the PrintPreviewTabController is in the middle of creating a
124 // print preview tab.
125 bool is_creating_print_preview_tab_;
126
117 DISALLOW_COPY_AND_ASSIGN(PrintPreviewTabController); 127 DISALLOW_COPY_AND_ASSIGN(PrintPreviewTabController);
118 }; 128 };
119 129
120 } // namespace printing 130 } // namespace printing
121 131
122 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_ 132 #endif // CHROME_BROWSER_PRINTING_PRINT_PREVIEW_TAB_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698