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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/md5.h" | 9 #include "base/md5.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 GURL CreateUpdateUrl(const std::string& device_id) { | 73 GURL CreateUpdateUrl(const std::string& device_id) { |
74 GURL url(std::string(kCloudPrintUrl) + "/update"); | 74 GURL url(std::string(kCloudPrintUrl) + "/update"); |
75 url = net::AppendQueryParameter(url, "printerid", device_id); | 75 url = net::AppendQueryParameter(url, "printerid", device_id); |
76 return url; | 76 return url; |
77 } | 77 } |
78 | 78 |
79 std::string LocalSettingsToJson(const LocalSettings& settings) { | 79 std::string LocalSettingsToJson(const LocalSettings& settings) { |
80 base::DictionaryValue dictionary; | 80 base::DictionaryValue dictionary; |
81 scoped_ptr<base::DictionaryValue> current(new DictionaryValue); | 81 scoped_ptr<base::DictionaryValue> current(new base::DictionaryValue); |
82 | 82 |
83 // TODO(maksymb): Formalize text as constants. | 83 // TODO(maksymb): Formalize text as constants. |
84 current->SetBoolean("local_discovery", settings.local_discovery); | 84 current->SetBoolean("local_discovery", settings.local_discovery); |
85 current->SetBoolean("access_token_enabled", settings.access_token_enabled); | 85 current->SetBoolean("access_token_enabled", settings.access_token_enabled); |
86 current->SetBoolean("printer/local_printing_enabled", | 86 current->SetBoolean("printer/local_printing_enabled", |
87 settings.local_printing_enabled); | 87 settings.local_printing_enabled); |
88 current->SetInteger("xmpp_timeout_value", settings.xmpp_timeout_value); | 88 current->SetInteger("xmpp_timeout_value", settings.xmpp_timeout_value); |
89 dictionary.Set("current", current.release()); | 89 dictionary.Set("current", current.release()); |
90 | 90 |
91 std::string local_settings; | 91 std::string local_settings; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 delegate_->OnLocalSettingsReceived(state, settings); | 459 delegate_->OnLocalSettingsReceived(state, settings); |
460 } else { | 460 } else { |
461 delegate_->OnServerError(error_description); | 461 delegate_->OnServerError(error_description); |
462 } | 462 } |
463 } | 463 } |
464 | 464 |
465 void CloudPrintRequester::ParseLocalSettingUpdated( | 465 void CloudPrintRequester::ParseLocalSettingUpdated( |
466 const std::string& response) { | 466 const std::string& response) { |
467 delegate_->OnLocalSettingsUpdated(); | 467 delegate_->OnLocalSettingsUpdated(); |
468 } | 468 } |
OLD | NEW |