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 "google_apis/gcm/base/mcs_util.h" | 5 #include "google_apis/gcm/base/mcs_util.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 COMPILE_ASSERT(arraysize(kProtoNames) == kNumProtoTypes, | 39 COMPILE_ASSERT(arraysize(kProtoNames) == kNumProtoTypes, |
40 ProtoNamesMustIncludeAllTags); | 40 ProtoNamesMustIncludeAllTags); |
41 | 41 |
42 const char kLoginId[] = "chrome-"; | 42 const char kLoginId[] = "chrome-"; |
43 const char kLoginDomain[] = "mcs.android.com"; | 43 const char kLoginDomain[] = "mcs.android.com"; |
44 const char kLoginDeviceIdPrefix[] = "android-"; | 44 const char kLoginDeviceIdPrefix[] = "android-"; |
45 const char kLoginSettingDefaultName[] = "new_vc"; | 45 const char kLoginSettingDefaultName[] = "new_vc"; |
46 const char kLoginSettingDefaultValue[] = "1"; | 46 const char kLoginSettingDefaultValue[] = "1"; |
47 | 47 |
48 // Maximum amount of time to save an unsent outgoing message for. | 48 // Maximum amount of time to save an unsent outgoing message for. |
49 const int kMaxTTLSeconds = 4 * 7 * 24 * 60 * 60; // 4 weeks. | 49 const int kMaxTTLSeconds = 24 * 60 * 60; // 1 day. |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 scoped_ptr<mcs_proto::LoginRequest> BuildLoginRequest( | 53 scoped_ptr<mcs_proto::LoginRequest> BuildLoginRequest( |
54 uint64 auth_id, | 54 uint64 auth_id, |
55 uint64 auth_token, | 55 uint64 auth_token, |
56 const std::string& version_string) { | 56 const std::string& version_string) { |
57 // Create a hex encoded auth id for the device id field. | 57 // Create a hex encoded auth id for the device id field. |
58 std::string auth_id_hex; | 58 std::string auth_id_hex; |
59 auth_id_hex = base::StringPrintf("%" PRIx64, auth_id); | 59 auth_id_hex = base::StringPrintf("%" PRIx64, auth_id); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 return 0; | 253 return 0; |
254 const mcs_proto::DataMessageStanza* data_message = | 254 const mcs_proto::DataMessageStanza* data_message = |
255 reinterpret_cast<const mcs_proto::DataMessageStanza*>(&protobuf); | 255 reinterpret_cast<const mcs_proto::DataMessageStanza*>(&protobuf); |
256 if (!data_message->has_ttl()) | 256 if (!data_message->has_ttl()) |
257 return kMaxTTLSeconds; | 257 return kMaxTTLSeconds; |
258 DCHECK_LE(data_message->ttl(), kMaxTTLSeconds); | 258 DCHECK_LE(data_message->ttl(), kMaxTTLSeconds); |
259 return data_message->ttl(); | 259 return data_message->ttl(); |
260 } | 260 } |
261 | 261 |
262 } // namespace gcm | 262 } // namespace gcm |
OLD | NEW |