OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cloud_print/gcp20/prototype/printer.h" | 5 #include "cloud_print/gcp20/prototype/printer.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 if (state_.registration_state != PrinterState::UNREGISTERED) | 227 if (state_.registration_state != PrinterState::UNREGISTERED) |
228 return PrivetHttpServer::REG_ERROR_INVALID_ACTION; | 228 return PrivetHttpServer::REG_ERROR_INVALID_ACTION; |
229 | 229 |
230 UpdateRegistrationExpiration(); | 230 UpdateRegistrationExpiration(); |
231 | 231 |
232 state_ = PrinterState(); | 232 state_ = PrinterState(); |
233 state_.user = user; | 233 state_.user = user; |
234 state_.registration_state = PrinterState::REGISTRATION_STARTED; | 234 state_.registration_state = PrinterState::REGISTRATION_STARTED; |
235 | 235 |
236 if (CommandLine::ForCurrentProcess()->HasSwitch("disable-confirmation")) { | 236 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 237 "disable-confirmation")) { |
237 state_.confirmation_state = PrinterState::CONFIRMATION_CONFIRMED; | 238 state_.confirmation_state = PrinterState::CONFIRMATION_CONFIRMED; |
238 VLOG(0) << "Registration confirmed by default."; | 239 VLOG(0) << "Registration confirmed by default."; |
239 } else { | 240 } else { |
240 LOG(WARNING) << kUserConfirmationTitle; | 241 LOG(WARNING) << kUserConfirmationTitle; |
241 base::Time valid_until = base::Time::Now() + | 242 base::Time valid_until = base::Time::Now() + |
242 base::TimeDelta::FromSeconds(kUserConfirmationTimeout); | 243 base::TimeDelta::FromSeconds(kUserConfirmationTimeout); |
243 base::MessageLoop::current()->PostTask( | 244 base::MessageLoop::current()->PostTask( |
244 FROM_HERE, | 245 FROM_HERE, |
245 base::Bind(&Printer::WaitUserConfirmation, AsWeakPtr(), valid_until)); | 246 base::Bind(&Printer::WaitUserConfirmation, AsWeakPtr(), valid_until)); |
246 } | 247 } |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 | 956 |
956 dns_server_.UpdateMetadata(CreateTxt()); | 957 dns_server_.UpdateMetadata(CreateTxt()); |
957 | 958 |
958 if (connection_state_ == OFFLINE) { | 959 if (connection_state_ == OFFLINE) { |
959 requester_.reset(); | 960 requester_.reset(); |
960 xmpp_listener_.reset(); | 961 xmpp_listener_.reset(); |
961 } | 962 } |
962 | 963 |
963 return true; | 964 return true; |
964 } | 965 } |
OLD | NEW |