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

Side by Side Diff: chrome/browser/printing/print_view_manager.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 #ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ 6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 15 matching lines...) Expand all
26 26
27 // Manages the print commands in relation to a TabContents. TabContents 27 // Manages the print commands in relation to a TabContents. TabContents
28 // delegates a few printing related commands to this instance. 28 // delegates a few printing related commands to this instance.
29 class PrintViewManager : public content::NotificationObserver, 29 class PrintViewManager : public content::NotificationObserver,
30 public PrintedPagesSource, 30 public PrintedPagesSource,
31 public TabContentsObserver { 31 public TabContentsObserver {
32 public: 32 public:
33 explicit PrintViewManager(TabContentsWrapper* tab); 33 explicit PrintViewManager(TabContentsWrapper* tab);
34 virtual ~PrintViewManager(); 34 virtual ~PrintViewManager();
35 35
36 // Override the title for this PrintViewManager's PrintJobs using the title
37 // in |tab_contents|.
38 void OverrideTitle(TabContents* tab_contents);
39
40 // Prints the current document immediately. Since the rendering is 36 // Prints the current document immediately. Since the rendering is
41 // asynchronous, the actual printing will not be completed on the return of 37 // asynchronous, the actual printing will not be completed on the return of
42 // this function. Returns false if printing is impossible at the moment. 38 // this function. Returns false if printing is impossible at the moment.
43 bool PrintNow(); 39 bool PrintNow();
44 40
45 // Same as PrintNow(), but for the case where a user prints with the system 41 // Same as PrintNow(), but for the case where a user prints with the system
46 // dialog from print preview. 42 // dialog from print preview.
47 bool PrintForSystemDialogNow(); 43 bool PrintForSystemDialogNow();
48 44
49 // Same as PrintNow(), but for the case where a user press "ctrl+shift+p" to 45 // Same as PrintNow(), but for the case where a user press "ctrl+shift+p" to
50 // show the native system dialog. This can happen from both initiator tab and 46 // show the native system dialog. This can happen from both initiator tab and
51 // preview tab. 47 // preview tab.
52 bool AdvancedPrintNow(); 48 bool AdvancedPrintNow();
53 49
54 // Initiate print preview of the current document by first notifying the 50 // Initiate print preview of the current document by first notifying the
55 // renderer. Since this happens asynchronous, the print preview tab creation 51 // renderer. Since this happens asynchronous, the print preview tab creation
56 // will not be completed on the return of this function. Returns false if 52 // will not be completed on the return of this function. Returns false if
57 // print preview is impossible at the moment. 53 // print preview is impossible at the moment.
58 bool PrintPreviewNow(); 54 bool PrintPreviewNow();
59 55
60 // Handles cancelled preview printing request. 56 // Handles cancelled preview printing request.
61 void PreviewPrintingRequestCancelled(); 57 void PreviewPrintingRequestCancelled();
62 58
63 // Sets |observer| as the current PrintViewManagerObserver. Pass in NULL to 59 // Sets |observer| as the current PrintViewManagerObserver. Pass in NULL to
64 // remove the current observer. |observer| may always be NULL, but |observer_| 60 // remove the current observer. |observer| may always be NULL, but |observer_|
65 // must be NULL if |observer| is non-NULL. 61 // must be NULL if |observer| is non-NULL.
66 void set_observer(PrintViewManagerObserver* observer); 62 void set_observer(PrintViewManagerObserver* observer);
67 63
68 // Reset |is_title_overridden_| to false.
69 void ResetTitleOverride();
70
71 // PrintedPagesSource implementation. 64 // PrintedPagesSource implementation.
72 virtual string16 RenderSourceName() OVERRIDE; 65 virtual string16 RenderSourceName() OVERRIDE;
73 66
74 // content::NotificationObserver implementation. 67 // content::NotificationObserver implementation.
75 virtual void Observe(int type, 68 virtual void Observe(int type,
76 const content::NotificationSource& source, 69 const content::NotificationSource& source,
77 const content::NotificationDetails& details) OVERRIDE; 70 const content::NotificationDetails& details) OVERRIDE;
78 71
79 // TabContentsObserver implementation. 72 // TabContentsObserver implementation.
80 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 73 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Running an inner message loop inside RenderAllMissingPagesNow(). This means 154 // Running an inner message loop inside RenderAllMissingPagesNow(). This means
162 // we are _blocking_ until all the necessary pages have been rendered or the 155 // we are _blocking_ until all the necessary pages have been rendered or the
163 // print settings are being loaded. 156 // print settings are being loaded.
164 bool inside_inner_message_loop_; 157 bool inside_inner_message_loop_;
165 158
166 #if defined(OS_POSIX) && !defined(OS_MACOSX) 159 #if defined(OS_POSIX) && !defined(OS_MACOSX)
167 // Set to true when OnDidPrintPage() should be expecting the first page. 160 // Set to true when OnDidPrintPage() should be expecting the first page.
168 bool expecting_first_page_; 161 bool expecting_first_page_;
169 #endif 162 #endif
170 163
171 // Title override.
172 bool is_title_overridden_;
173 string16 overridden_title_;
174
175 // Weak pointer to an observer that is notified when the print dialog is 164 // Weak pointer to an observer that is notified when the print dialog is
176 // shown. 165 // shown.
177 PrintViewManagerObserver* observer_; 166 PrintViewManagerObserver* observer_;
178 167
179 // The document cookie of the current PrinterQuery. 168 // The document cookie of the current PrinterQuery.
180 int cookie_; 169 int cookie_;
181 170
182 DISALLOW_COPY_AND_ASSIGN(PrintViewManager); 171 DISALLOW_COPY_AND_ASSIGN(PrintViewManager);
183 }; 172 };
184 173
185 } // namespace printing 174 } // namespace printing
186 175
187 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ 176 #endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698