Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/service/cloud_print/cloud_print_proxy.h" | 5 #include "chrome/service/cloud_print/cloud_print_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 } | 221 } |
| 222 | 222 |
| 223 void CloudPrintProxy::OnUnregisterPrinters( | 223 void CloudPrintProxy::OnUnregisterPrinters( |
| 224 const std::string& auth_token, | 224 const std::string& auth_token, |
| 225 const std::list<std::string>& printer_ids) { | 225 const std::list<std::string>& printer_ids) { |
| 226 UMA_HISTOGRAM_COUNTS_10000("CloudPrint.UnregisterPrinters", | 226 UMA_HISTOGRAM_COUNTS_10000("CloudPrint.UnregisterPrinters", |
| 227 printer_ids.size()); | 227 printer_ids.size()); |
| 228 ShutdownBackend(); | 228 ShutdownBackend(); |
| 229 ConnectorSettings settings; | 229 ConnectorSettings settings; |
| 230 settings.InitFrom(service_prefs_); | 230 settings.InitFrom(service_prefs_); |
| 231 wipeout_.reset(new CloudPrintWipeout(this, settings.server_url())); | 231 net::PartialNetworkTrafficAnnotationTag partial_traffic_annotation = |
| 232 net::DefinePartialNetworkTrafficAnnotation("cloud_print_proxy", | |
| 233 "cloud_print", R"( | |
| 234 semantics { | |
| 235 description: | |
| 236 "Sends a request to Cloud Print to unregister one or more " | |
| 237 "printers." | |
| 238 trigger: | |
| 239 "User request of unregistering printers or policy change." | |
|
msramek
2017/06/08 21:23:32
nit: Just to be a bit more explicit, can we say wh
Ramin Halavati
2017/06/09 04:55:46
Done, but note that the report that is generated u
| |
| 240 data: "OAuth2 token and list of parinter ids to unregister." | |
| 241 })"); | |
| 242 wipeout_.reset(new CloudPrintWipeout(this, settings.server_url(), | |
| 243 partial_traffic_annotation)); | |
| 232 wipeout_->UnregisterPrinters(auth_token, printer_ids); | 244 wipeout_->UnregisterPrinters(auth_token, printer_ids); |
| 233 } | 245 } |
| 234 | 246 |
| 235 void CloudPrintProxy::OnXmppPingUpdated(int ping_timeout) { | 247 void CloudPrintProxy::OnXmppPingUpdated(int ping_timeout) { |
| 236 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | 248 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 237 service_prefs_->SetInt(prefs::kCloudPrintXmppPingTimeout, ping_timeout); | 249 service_prefs_->SetInt(prefs::kCloudPrintXmppPingTimeout, ping_timeout); |
| 238 service_prefs_->WritePrefs(); | 250 service_prefs_->WritePrefs(); |
| 239 } | 251 } |
| 240 | 252 |
| 241 void CloudPrintProxy::OnUnregisterPrintersComplete() { | 253 void CloudPrintProxy::OnUnregisterPrintersComplete() { |
| 242 wipeout_.reset(); | 254 wipeout_.reset(); |
| 243 // Finish disabling cloud print for this user. | 255 // Finish disabling cloud print for this user. |
| 244 DisableForUser(); | 256 DisableForUser(); |
| 245 } | 257 } |
| 246 | 258 |
| 247 void CloudPrintProxy::ShutdownBackend() { | 259 void CloudPrintProxy::ShutdownBackend() { |
| 248 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | 260 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 249 if (backend_.get()) | 261 if (backend_.get()) |
| 250 backend_->Shutdown(); | 262 backend_->Shutdown(); |
| 251 backend_.reset(); | 263 backend_.reset(); |
| 252 } | 264 } |
| 253 | 265 |
| 254 } // namespace cloud_print | 266 } // namespace cloud_print |
| OLD | NEW |