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 <stdio.h> | 7 #include <stdio.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 return state_.local_settings.local_printing_enabled; | 406 return state_.local_settings.local_printing_enabled; |
407 } | 407 } |
408 | 408 |
409 bool Printer::CheckXPrivetTokenHeader(const std::string& token) const { | 409 bool Printer::CheckXPrivetTokenHeader(const std::string& token) const { |
410 return xtoken_.CheckValidXToken(token); | 410 return xtoken_.CheckValidXToken(token); |
411 } | 411 } |
412 | 412 |
413 const base::DictionaryValue& Printer::GetCapabilities() { | 413 const base::DictionaryValue& Printer::GetCapabilities() { |
414 if (!state_.cdd.get()) { | 414 if (!state_.cdd.get()) { |
415 std::string cdd_string; | 415 std::string cdd_string; |
416 ReplaceChars(kCdd, "'", "\"", &cdd_string); | 416 base::ReplaceChars(kCdd, "'", "\"", &cdd_string); |
417 scoped_ptr<base::Value> json_val(base::JSONReader::Read(cdd_string)); | 417 scoped_ptr<base::Value> json_val(base::JSONReader::Read(cdd_string)); |
418 base::DictionaryValue* json = NULL; | 418 base::DictionaryValue* json = NULL; |
419 CHECK(json_val->GetAsDictionary(&json)); | 419 CHECK(json_val->GetAsDictionary(&json)); |
420 state_.cdd.reset(json->DeepCopy()); | 420 state_.cdd.reset(json->DeepCopy()); |
421 } | 421 } |
422 return *state_.cdd; | 422 return *state_.cdd; |
423 } | 423 } |
424 | 424 |
425 LocalPrintJob::CreateResult Printer::CreateJob(const std::string& ticket, | 425 LocalPrintJob::CreateResult Printer::CreateJob(const std::string& ticket, |
426 std::string* job_id, | 426 std::string* job_id, |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 | 955 |
956 dns_server_.UpdateMetadata(CreateTxt()); | 956 dns_server_.UpdateMetadata(CreateTxt()); |
957 | 957 |
958 if (connection_state_ == OFFLINE) { | 958 if (connection_state_ == OFFLINE) { |
959 requester_.reset(); | 959 requester_.reset(); |
960 xmpp_listener_.reset(); | 960 xmpp_listener_.reset(); |
961 } | 961 } |
962 | 962 |
963 return true; | 963 return true; |
964 } | 964 } |
OLD | NEW |