OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "remoting/host/gcd_rest_client.h" | 5 #include "remoting/host/gcd_rest_client.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
9 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
10 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
11 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
12 #include "base/time/default_clock.h" | 14 #include "base/time/default_clock.h" |
13 #include "base/values.h" | 15 #include "base/values.h" |
14 #include "net/url_request/url_fetcher.h" | 16 #include "net/url_request/url_fetcher.h" |
15 #include "remoting/base/logging.h" | 17 #include "remoting/base/logging.h" |
16 | 18 |
(...skipping 25 matching lines...) Expand all Loading... |
42 // | 44 // |
43 // { | 45 // { |
44 // requestTimeMs: T, | 46 // requestTimeMs: T, |
45 // patches: [{ | 47 // patches: [{ |
46 // timeMs: T, | 48 // timeMs: T, |
47 // patch: {...} | 49 // patch: {...} |
48 // }] | 50 // }] |
49 // } | 51 // } |
50 // | 52 // |
51 // Note that |now| is deliberately using a double to hold an integer | 53 // Note that |now| is deliberately using a double to hold an integer |
52 // value because |DictionaryValue| doesn't support int64 values, and | 54 // value because |DictionaryValue| doesn't support int64_t values, and |
53 // GCD doesn't accept fractional values. | 55 // GCD doesn't accept fractional values. |
54 double now = clock_->Now().ToJavaTime(); | 56 double now = clock_->Now().ToJavaTime(); |
55 scoped_ptr<base::DictionaryValue> patch_dict(new base::DictionaryValue); | 57 scoped_ptr<base::DictionaryValue> patch_dict(new base::DictionaryValue); |
56 patch_dict->SetDouble("requestTimeMs", now); | 58 patch_dict->SetDouble("requestTimeMs", now); |
57 scoped_ptr<base::ListValue> patch_list(new base::ListValue); | 59 scoped_ptr<base::ListValue> patch_list(new base::ListValue); |
58 base::DictionaryValue* patch_item = new base::DictionaryValue; | 60 base::DictionaryValue* patch_item = new base::DictionaryValue; |
59 patch_list->Append(patch_item); | 61 patch_list->Append(patch_item); |
60 patch_item->Set("patch", patch_details.Pass()); | 62 patch_item->Set("patch", patch_details.Pass()); |
61 patch_item->SetDouble("timeMs", now); | 63 patch_item->SetDouble("timeMs", now); |
62 patch_dict->Set("patches", patch_list.Pass()); | 64 patch_dict->Set("patches", patch_list.Pass()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 << ") fetching URL: " << request_url; | 133 << ") fetching URL: " << request_url; |
132 status = NETWORK_ERROR; | 134 status = NETWORK_ERROR; |
133 } else { | 135 } else { |
134 LOG(ERROR) << "Error (" << response << ") fetching URL: " << request_url; | 136 LOG(ERROR) << "Error (" << response << ") fetching URL: " << request_url; |
135 } | 137 } |
136 | 138 |
137 FinishCurrentRequest(status); | 139 FinishCurrentRequest(status); |
138 } | 140 } |
139 | 141 |
140 } // namespace remoting | 142 } // namespace remoting |
OLD | NEW |