| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CHROMEOS_PRINTING_FAKE_CUPS_PRINT_JOB_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_PRINTING_FAKE_CUPS_PRINT_JOB_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_PRINTING_FAKE_CUPS_PRINT_JOB_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PRINTING_FAKE_CUPS_PRINT_JOB_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/browser/chromeos/printing/cups_print_job_manager.h" | 14 #include "chrome/browser/chromeos/printing/cups_print_job_manager.h" |
| 15 | 15 |
| 16 class Profile; | 16 class Profile; |
| 17 | 17 |
| 18 namespace chromeos { | 18 namespace chromeos { |
| 19 | 19 |
| 20 class FakeCupsPrintJobManager : public CupsPrintJobManager { | 20 class FakeCupsPrintJobManager : public CupsPrintJobManager { |
| 21 public: | 21 public: |
| 22 explicit FakeCupsPrintJobManager(Profile* profile); | 22 explicit FakeCupsPrintJobManager(Profile* profile); |
| 23 ~FakeCupsPrintJobManager() override; | 23 ~FakeCupsPrintJobManager() override; |
| 24 | 24 |
| 25 bool CreatePrintJob(const std::string& printer_name, | 25 bool CreatePrintJob(const std::string& printer_name, |
| 26 const std::string& title, | 26 const std::string& title, |
| 27 int total_page_number); | 27 int total_page_number); |
| 28 | 28 |
| 29 bool CancelPrintJob(CupsPrintJob* job) override; | 29 void CancelPrintJob(CupsPrintJob* job) override; |
| 30 bool SuspendPrintJob(CupsPrintJob* job) override; | 30 bool SuspendPrintJob(CupsPrintJob* job) override; |
| 31 bool ResumePrintJob(CupsPrintJob* job) override; | 31 bool ResumePrintJob(CupsPrintJob* job) override; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 void ChangePrintJobState(CupsPrintJob* job); | 34 void ChangePrintJobState(CupsPrintJob* job); |
| 35 | 35 |
| 36 using PrintJobs = std::vector<std::unique_ptr<CupsPrintJob>>; | 36 using PrintJobs = std::vector<std::unique_ptr<CupsPrintJob>>; |
| 37 | 37 |
| 38 PrintJobs print_jobs_; | 38 PrintJobs print_jobs_; |
| 39 static int next_job_id_; | 39 static int next_job_id_; |
| 40 base::WeakPtrFactory<FakeCupsPrintJobManager> weak_ptr_factory_; | 40 base::WeakPtrFactory<FakeCupsPrintJobManager> weak_ptr_factory_; |
| 41 | 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(FakeCupsPrintJobManager); | 42 DISALLOW_COPY_AND_ASSIGN(FakeCupsPrintJobManager); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 } // namespace chromeos | 45 } // namespace chromeos |
| 46 | 46 |
| 47 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_FAKE_CUPS_PRINT_JOB_MANAGER_H_ | 47 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_FAKE_CUPS_PRINT_JOB_MANAGER_H_ |
| OLD | NEW |