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/cloud_print_requester.h" | 5 #include "cloud_print/gcp20/prototype/cloud_print_requester.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | |
9 #include <limits> | 8 #include <limits> |
| 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
13 #include "base/md5.h" | 13 #include "base/md5.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/rand_util.h" | 15 #include "base/rand_util.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "cloud_print/gcp20/prototype/cloud_print_url_request_context_getter.h" | 17 #include "cloud_print/gcp20/prototype/cloud_print_url_request_context_getter.h" |
18 #include "google_apis/google_api_keys.h" | 18 #include "google_apis/google_api_keys.h" |
19 #include "net/base/escape.h" | 19 #include "net/base/escape.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 std::string LocalSettingsToJson(const LocalSettings& settings) { | 83 std::string LocalSettingsToJson(const LocalSettings& settings) { |
84 base::DictionaryValue dictionary; | 84 base::DictionaryValue dictionary; |
85 scoped_ptr<base::DictionaryValue> current(new base::DictionaryValue); | 85 scoped_ptr<base::DictionaryValue> current(new base::DictionaryValue); |
86 | 86 |
87 // TODO(maksymb): Formalize text as constants. | 87 // TODO(maksymb): Formalize text as constants. |
88 current->SetBoolean("local_discovery", settings.local_discovery); | 88 current->SetBoolean("local_discovery", settings.local_discovery); |
89 current->SetBoolean("access_token_enabled", settings.access_token_enabled); | 89 current->SetBoolean("access_token_enabled", settings.access_token_enabled); |
90 current->SetBoolean("printer/local_printing_enabled", | 90 current->SetBoolean("printer/local_printing_enabled", |
91 settings.local_printing_enabled); | 91 settings.local_printing_enabled); |
92 current->SetInteger("xmpp_timeout_value", settings.xmpp_timeout_value); | 92 current->SetInteger("xmpp_timeout_value", settings.xmpp_timeout_value); |
93 dictionary.Set("current", current.Pass()); | 93 dictionary.Set("current", std::move(current)); |
94 | 94 |
95 std::string local_settings; | 95 std::string local_settings; |
96 base::JSONWriter::Write(dictionary, &local_settings); | 96 base::JSONWriter::Write(dictionary, &local_settings); |
97 return local_settings; | 97 return local_settings; |
98 } | 98 } |
99 | 99 |
100 } // namespace | 100 } // namespace |
101 | 101 |
102 using cloud_print_response_parser::Job; | 102 using cloud_print_response_parser::Job; |
103 | 103 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 delegate_->OnLocalSettingsReceived(state, settings); | 463 delegate_->OnLocalSettingsReceived(state, settings); |
464 } else { | 464 } else { |
465 delegate_->OnServerError(error_description); | 465 delegate_->OnServerError(error_description); |
466 } | 466 } |
467 } | 467 } |
468 | 468 |
469 void CloudPrintRequester::ParseLocalSettingUpdated( | 469 void CloudPrintRequester::ParseLocalSettingUpdated( |
470 const std::string& response) { | 470 const std::string& response) { |
471 delegate_->OnLocalSettingsUpdated(); | 471 delegate_->OnLocalSettingsUpdated(); |
472 } | 472 } |
OLD | NEW |