print_job_worker_owner.h revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__
6#define CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__
7
8#include "base/memory/ref_counted.h"
9#include "printing/printing_context.h"
10
11namespace base {
12class MessageLoop;
13}
14
15
16namespace printing {
17
18class PrintJobWorker;
19class PrintSettings;
20
21class PrintJobWorkerOwner
22    : public base::RefCountedThreadSafe<PrintJobWorkerOwner> {
23 public:
24  // Finishes the initialization began by PrintJobWorker::GetSettings().
25  // Creates a new PrintedDocument if necessary. Solely meant to be called by
26  // PrintJobWorker.
27  virtual void GetSettingsDone(const PrintSettings& new_settings,
28                               PrintingContext::Result result) = 0;
29
30  // Detach the PrintJobWorker associated to this object.
31  virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner) = 0;
32
33  // Retrieves the message loop that is expected to process GetSettingsDone.
34  virtual base::MessageLoop* message_loop() = 0;
35
36  // Access the current settings.
37  virtual const PrintSettings& settings() const = 0;
38
39  // Cookie uniquely identifying the PrintedDocument and/or loaded settings.
40  virtual int cookie() const = 0;
41
42 protected:
43  friend class base::RefCountedThreadSafe<PrintJobWorkerOwner>;
44
45  virtual ~PrintJobWorkerOwner() {}
46};
47
48}  // namespace printing
49
50#endif  // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__
51