Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1224)

Unified Diff: chrome/service/cloud_print/connector_settings.cc

Issue 10966052: Added options to disable specific printers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/service/cloud_print/connector_settings.cc
diff --git a/chrome/service/cloud_print/connector_settings.cc b/chrome/service/cloud_print/connector_settings.cc
index f40091462ab6a45312e1d1267d47193f08308f62..0976c422ccd22b451385d229e9059568c9066cfb 100644
--- a/chrome/service/cloud_print/connector_settings.cc
+++ b/chrome/service/cloud_print/connector_settings.cc
@@ -18,7 +18,8 @@ const char kDeleteOnEnumFail[] = "delete_on_enum_fail";
} // namespace
ConnectorSettings::ConnectorSettings()
- : delete_on_enum_fail_(false) {
+ : delete_on_enum_fail_(false),
+ connect_new_printers_(true) {
}
ConnectorSettings::~ConnectorSettings() {
@@ -52,12 +53,30 @@ void ConnectorSettings::InitFrom(ServiceProcessPrefs* prefs) {
server_url_ = GURL(kDefaultCloudPrintServerUrl);
}
DCHECK(server_url_.is_valid());
+
+ connect_new_printers_ = prefs->GetBoolean(
+ prefs::kCloudPrintConnectNewPrinters, true);
+ const base::ListValue* printers = prefs->GetList(
+ prefs::kCloudPrintPrinterBlacklist);
+ if (printers) {
+ for (size_t i = 0; i < printers->GetSize(); ++i) {
+ std::string printer;
+ if (printers->GetString(i, &printer))
+ printer_blacklist_.insert(printer);
+ }
+ }
}
+bool ConnectorSettings::IsPrinterBlacklisted(const std::string& name) const {
+ return printer_blacklist_.find(name) != printer_blacklist_.end();
+};
+
void ConnectorSettings::CopyFrom(const ConnectorSettings& source) {
server_url_ = source.server_url();
proxy_id_ = source.proxy_id();
delete_on_enum_fail_ = source.delete_on_enum_fail();
+ connect_new_printers_ = source.connect_new_printers();
+ printer_blacklist_ = source.printer_blacklist_;
if (source.print_system_settings())
print_system_settings_.reset(source.print_system_settings()->DeepCopy());
}
« no previous file with comments | « chrome/service/cloud_print/connector_settings.h ('k') | chrome/service/cloud_print/connector_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698