Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / printing / print_job_worker_owner.h
blob00a561a39bb6532e95733b14fd8867f5b7cfdaff
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.
5 #ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__
6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__
8 #include "base/memory/ref_counted.h"
9 #include "printing/printing_context.h"
11 namespace base {
12 class MessageLoop;
13 class SequencedTaskRunner;
16 namespace tracked_objects {
17 class Location;
20 namespace printing {
22 class PrintJobWorker;
23 class PrintSettings;
25 class PrintJobWorkerOwner
26 : public base::RefCountedThreadSafe<PrintJobWorkerOwner> {
27 public:
28 PrintJobWorkerOwner();
30 // Finishes the initialization began by PrintJobWorker::GetSettings().
31 // Creates a new PrintedDocument if necessary. Solely meant to be called by
32 // PrintJobWorker.
33 virtual void GetSettingsDone(const PrintSettings& new_settings,
34 PrintingContext::Result result) = 0;
36 // Detach the PrintJobWorker associated to this object.
37 virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner) = 0;
39 // Access the current settings.
40 virtual const PrintSettings& settings() const = 0;
42 // Cookie uniquely identifying the PrintedDocument and/or loaded settings.
43 virtual int cookie() const = 0;
45 // Returns true if the current thread is a thread on which a task
46 // may be run, and false if no task will be run on the current
47 // thread.
48 bool RunsTasksOnCurrentThread() const;
50 // Posts the given task to be run.
51 bool PostTask(const tracked_objects::Location& from_here,
52 const base::Closure& task);
54 protected:
55 friend class base::RefCountedThreadSafe<PrintJobWorkerOwner>;
57 virtual ~PrintJobWorkerOwner();
59 // Task runner reference. Used to send notifications in the right
60 // thread.
61 scoped_refptr<base::SequencedTaskRunner> task_runner_;
64 } // namespace printing
66 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_WORKER_OWNER_H__