| 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_PRINTER_PREF_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_PRINTING_PRINTER_PREF_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_PRINTING_PRINTER_PREF_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PRINTING_PRINTER_PREF_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class PrinterPrefManager : public KeyedService { | 24 class PrinterPrefManager : public KeyedService { |
| 25 public: | 25 public: |
| 26 explicit PrinterPrefManager(Profile* profile); | 26 explicit PrinterPrefManager(Profile* profile); |
| 27 | 27 |
| 28 // Register the printing preferences with the |registry|. | 28 // Register the printing preferences with the |registry|. |
| 29 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 29 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 30 | 30 |
| 31 // Returns the printers that are saved in preferences. | 31 // Returns the printers that are saved in preferences. |
| 32 std::vector<std::unique_ptr<Printer>> GetPrinters() const; | 32 std::vector<std::unique_ptr<Printer>> GetPrinters() const; |
| 33 | 33 |
| 34 // Returns the printer with id |printer_id|. |
| 35 std::unique_ptr<Printer> GetPrinter(const std::string& printer_id) const; |
| 36 |
| 34 // Adds or updates a printer. Printers are identified by the id field. Use an | 37 // Adds or updates a printer. Printers are identified by the id field. Use an |
| 35 // empty id to add a new printer. | 38 // empty id to add a new printer. |
| 36 void RegisterPrinter(std::unique_ptr<Printer> printer); | 39 void RegisterPrinter(std::unique_ptr<Printer> printer); |
| 37 | 40 |
| 38 // Remove printer from preferences with the id |printer_id|. Returns true if | 41 // Remove printer from preferences with the id |printer_id|. Returns true if |
| 39 // the printer was successfully removed. | 42 // the printer was successfully removed. |
| 40 bool RemovePrinter(const std::string& printer_id); | 43 bool RemovePrinter(const std::string& printer_id); |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 Profile* profile_; | 46 Profile* profile_; |
| 44 }; | 47 }; |
| 45 | 48 |
| 46 } // namespace chromeos | 49 } // namespace chromeos |
| 47 | 50 |
| 48 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_PRINTER_PREF_MANAGER_H_ | 51 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_PRINTER_PREF_MANAGER_H_ |
| OLD | NEW |