зеркало из https://github.com/electron/electron.git
PrintedPageSource has been removed
This commit is contained in:
Родитель
6402b23041
Коммит
c3dec709ab
|
@ -45,8 +45,7 @@ void HoldRefCallback(const scoped_refptr<PrintJobWorkerOwner>& owner,
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
PrintJob::PrintJob()
|
PrintJob::PrintJob()
|
||||||
: source_(nullptr),
|
: is_job_pending_(false),
|
||||||
is_job_pending_(false),
|
|
||||||
is_canceling_(false),
|
is_canceling_(false),
|
||||||
quit_factory_(this) {
|
quit_factory_(this) {
|
||||||
// This is normally a UI message loop, but in unit tests, the message loop is
|
// This is normally a UI message loop, but in unit tests, the message loop is
|
||||||
|
@ -65,19 +64,17 @@ PrintJob::~PrintJob() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintJob::Initialize(PrintJobWorkerOwner* job,
|
void PrintJob::Initialize(PrintJobWorkerOwner* job,
|
||||||
PrintedPagesSource* source,
|
const base::string16& name,
|
||||||
int page_count) {
|
int page_count) {
|
||||||
DCHECK(!source_);
|
|
||||||
DCHECK(!worker_);
|
DCHECK(!worker_);
|
||||||
DCHECK(!is_job_pending_);
|
DCHECK(!is_job_pending_);
|
||||||
DCHECK(!is_canceling_);
|
DCHECK(!is_canceling_);
|
||||||
DCHECK(!document_.get());
|
DCHECK(!document_.get());
|
||||||
source_ = source;
|
|
||||||
worker_ = job->DetachWorker(this);
|
worker_ = job->DetachWorker(this);
|
||||||
settings_ = job->settings();
|
settings_ = job->settings();
|
||||||
|
|
||||||
PrintedDocument* new_doc =
|
PrintedDocument* new_doc =
|
||||||
new PrintedDocument(settings_, source_, job->cookie());
|
new PrintedDocument(settings_, name, job->cookie());
|
||||||
new_doc->set_page_count(page_count);
|
new_doc->set_page_count(page_count);
|
||||||
UpdatePrintedDocument(new_doc);
|
UpdatePrintedDocument(new_doc);
|
||||||
|
|
||||||
|
@ -204,12 +201,6 @@ bool PrintJob::FlushJob(base::TimeDelta timeout) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintJob::DisconnectSource() {
|
|
||||||
source_ = nullptr;
|
|
||||||
if (document_.get())
|
|
||||||
document_->DisconnectSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PrintJob::is_job_pending() const {
|
bool PrintJob::is_job_pending() const {
|
||||||
return is_job_pending_;
|
return is_job_pending_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ class PdfToEmfConverter;
|
||||||
class PrintJobWorker;
|
class PrintJobWorker;
|
||||||
class PrintedDocument;
|
class PrintedDocument;
|
||||||
class PrintedPage;
|
class PrintedPage;
|
||||||
class PrintedPagesSource;
|
|
||||||
class PrinterQuery;
|
class PrinterQuery;
|
||||||
|
|
||||||
// Manages the print work for a specific document. Talks to the printer through
|
// Manages the print work for a specific document. Talks to the printer through
|
||||||
|
@ -45,7 +44,8 @@ class PrintJob : public PrintJobWorkerOwner,
|
||||||
|
|
||||||
// Grabs the ownership of the PrintJobWorker from another job, which is
|
// Grabs the ownership of the PrintJobWorker from another job, which is
|
||||||
// usually a PrinterQuery. Set the expected page count of the print job.
|
// usually a PrinterQuery. Set the expected page count of the print job.
|
||||||
void Initialize(PrintJobWorkerOwner* job, PrintedPagesSource* source,
|
void Initialize(PrintJobWorkerOwner* job,
|
||||||
|
const base::string16& name,
|
||||||
int page_count);
|
int page_count);
|
||||||
|
|
||||||
// content::NotificationObserver implementation.
|
// content::NotificationObserver implementation.
|
||||||
|
@ -80,10 +80,6 @@ class PrintJob : public PrintJobWorkerOwner,
|
||||||
// our data.
|
// our data.
|
||||||
bool FlushJob(base::TimeDelta timeout);
|
bool FlushJob(base::TimeDelta timeout);
|
||||||
|
|
||||||
// Disconnects the PrintedPage source (PrintedPagesSource). It is done when
|
|
||||||
// the source is being destroyed.
|
|
||||||
void DisconnectSource();
|
|
||||||
|
|
||||||
// Returns true if the print job is pending, i.e. between a StartPrinting()
|
// Returns true if the print job is pending, i.e. between a StartPrinting()
|
||||||
// and the end of the spooling.
|
// and the end of the spooling.
|
||||||
bool is_job_pending() const;
|
bool is_job_pending() const;
|
||||||
|
@ -140,10 +136,6 @@ class PrintJob : public PrintJobWorkerOwner,
|
||||||
|
|
||||||
content::NotificationRegistrar registrar_;
|
content::NotificationRegistrar registrar_;
|
||||||
|
|
||||||
// Source that generates the PrintedPage's (i.e. a WebContents). It will be
|
|
||||||
// set back to NULL if the source is deleted before this object.
|
|
||||||
PrintedPagesSource* source_;
|
|
||||||
|
|
||||||
// All the UI is done in a worker thread because many Win32 print functions
|
// All the UI is done in a worker thread because many Win32 print functions
|
||||||
// are blocking and enters a message loop without your consent. There is one
|
// are blocking and enters a message loop without your consent. There is one
|
||||||
// worker thread per print job.
|
// worker thread per print job.
|
||||||
|
|
|
@ -349,7 +349,7 @@ bool PrintViewManagerBase::CreateNewPrintJob(PrintJobWorkerOwner* job) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
print_job_ = new PrintJob();
|
print_job_ = new PrintJob();
|
||||||
print_job_->Initialize(job, this, number_pages_);
|
print_job_->Initialize(job, RenderSourceName(), number_pages_);
|
||||||
registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
|
registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
|
||||||
content::Source<PrintJob>(print_job_.get()));
|
content::Source<PrintJob>(print_job_.get()));
|
||||||
printing_succeeded_ = false;
|
printing_succeeded_ = false;
|
||||||
|
@ -414,7 +414,6 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
||||||
|
|
||||||
registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
|
registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
|
||||||
content::Source<PrintJob>(print_job_.get()));
|
content::Source<PrintJob>(print_job_.get()));
|
||||||
print_job_->DisconnectSource();
|
|
||||||
// Don't close the worker thread.
|
// Don't close the worker thread.
|
||||||
print_job_ = NULL;
|
print_job_ = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include "content/public/browser/notification_registrar.h"
|
#include "content/public/browser/notification_registrar.h"
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
#include "content/public/browser/web_contents_observer.h"
|
||||||
#include "content/public/browser/web_contents_user_data.h"
|
#include "content/public/browser/web_contents_user_data.h"
|
||||||
#include "printing/printed_pages_source.h"
|
|
||||||
|
|
||||||
struct PrintHostMsg_DidPrintPage_Params;
|
struct PrintHostMsg_DidPrintPage_Params;
|
||||||
|
|
||||||
|
@ -33,7 +32,6 @@ class PrintQueriesQueue;
|
||||||
|
|
||||||
// Base class for managing the print commands for a WebContents.
|
// Base class for managing the print commands for a WebContents.
|
||||||
class PrintViewManagerBase : public content::NotificationObserver,
|
class PrintViewManagerBase : public content::NotificationObserver,
|
||||||
public PrintedPagesSource,
|
|
||||||
public content::WebContentsObserver {
|
public content::WebContentsObserver {
|
||||||
public:
|
public:
|
||||||
virtual ~PrintViewManagerBase();
|
virtual ~PrintViewManagerBase();
|
||||||
|
@ -48,7 +46,7 @@ class PrintViewManagerBase : public content::NotificationObserver,
|
||||||
#endif // !DISABLE_BASIC_PRINTING
|
#endif // !DISABLE_BASIC_PRINTING
|
||||||
|
|
||||||
// PrintedPagesSource implementation.
|
// PrintedPagesSource implementation.
|
||||||
virtual base::string16 RenderSourceName() override;
|
base::string16 RenderSourceName();
|
||||||
|
|
||||||
void SetCallback(const base::Callback<void(bool)>& cb) {
|
void SetCallback(const base::Callback<void(bool)>& cb) {
|
||||||
callback = cb;
|
callback = cb;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче