Chromium Code Reviews| 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 <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 | 33 |
| 34 // Returns the printers that are saved in preferences. | 34 // Returns the printers that are saved in preferences. |
| 35 std::vector<std::unique_ptr<Printer>> GetPrinters() const; | 35 std::vector<std::unique_ptr<Printer>> GetPrinters() const; |
| 36 | 36 |
| 37 // Returns printers from enterprise policy. | 37 // Returns printers from enterprise policy. |
| 38 std::vector<std::unique_ptr<Printer>> GetRecommendedPrinters() const; | 38 std::vector<std::unique_ptr<Printer>> GetRecommendedPrinters() const; |
| 39 | 39 |
| 40 // Returns the printer with id |printer_id|. | 40 // Returns the printer with id |printer_id|. |
| 41 std::unique_ptr<Printer> GetPrinter(const std::string& printer_id) const; | 41 std::unique_ptr<Printer> GetPrinter(const std::string& printer_id) const; |
| 42 | 42 |
| 43 // Returns true if the printer is enterprise policy controlled printer. | |
| 44 bool IsEnterprisePrinter(const std::string& printer_id) const; | |
|
skau
2017/01/10 19:55:52
I would make this a property of printer rather tha
xdai1
2017/01/10 21:45:28
Done. Thanks for the suggestion!
| |
| 45 | |
| 43 // Adds or updates a printer. Printers are identified by the id field. Use an | 46 // Adds or updates a printer. Printers are identified by the id field. Use an |
| 44 // empty id to add a new printer. | 47 // empty id to add a new printer. |
| 45 void RegisterPrinter(std::unique_ptr<Printer> printer); | 48 void RegisterPrinter(std::unique_ptr<Printer> printer); |
| 46 | 49 |
| 47 // Remove printer from preferences with the id |printer_id|. Returns true if | 50 // Remove printer from preferences with the id |printer_id|. Returns true if |
| 48 // the printer was successfully removed. | 51 // the printer was successfully removed. |
| 49 bool RemovePrinter(const std::string& printer_id); | 52 bool RemovePrinter(const std::string& printer_id); |
| 50 | 53 |
| 51 private: | 54 private: |
| 52 // Updates the in-memory recommended printer list. | 55 // Updates the in-memory recommended printer list. |
| 53 void UpdateRecommendedPrinters(); | 56 void UpdateRecommendedPrinters(); |
| 54 | 57 |
| 55 Profile* profile_; | 58 Profile* profile_; |
| 56 PrefChangeRegistrar pref_change_registrar_; | 59 PrefChangeRegistrar pref_change_registrar_; |
| 57 | 60 |
| 58 // Contains the keys for all recommended printers in order so we can return | 61 // Contains the keys for all recommended printers in order so we can return |
| 59 // the list of recommended printers in the order they were received. | 62 // the list of recommended printers in the order they were received. |
| 60 std::vector<std::string> recommended_printer_ids_; | 63 std::vector<std::string> recommended_printer_ids_; |
| 61 std::map<std::string, std::unique_ptr<base::DictionaryValue>> | 64 std::map<std::string, std::unique_ptr<base::DictionaryValue>> |
| 62 recommended_printers_; | 65 recommended_printers_; |
| 63 }; | 66 }; |
| 64 | 67 |
| 65 } // namespace chromeos | 68 } // namespace chromeos |
| 66 | 69 |
| 67 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_PRINTER_PREF_MANAGER_H_ | 70 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_PRINTER_PREF_MANAGER_H_ |
| OLD | NEW |