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