OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/speech/google_streaming_remote_engine.h" | 5 #include "content/browser/speech/google_streaming_remote_engine.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 langs = accepted_language_list.substr(0, separator); | 556 langs = accepted_language_list.substr(0, separator); |
557 } | 557 } |
558 } | 558 } |
559 if (langs.empty()) | 559 if (langs.empty()) |
560 langs = "en-US"; | 560 langs = "en-US"; |
561 return langs; | 561 return langs; |
562 } | 562 } |
563 | 563 |
564 // TODO(primiano): Is there any utility in the codebase that already does this? | 564 // TODO(primiano): Is there any utility in the codebase that already does this? |
565 std::string GoogleStreamingRemoteEngine::GenerateRequestKey() const { | 565 std::string GoogleStreamingRemoteEngine::GenerateRequestKey() const { |
566 const int64 kKeepLowBytes = GG_LONGLONG(0x00000000FFFFFFFF); | 566 const int64 kKeepLowBytes = 0x00000000FFFFFFFFLL; |
567 const int64 kKeepHighBytes = GG_LONGLONG(0xFFFFFFFF00000000); | 567 const int64 kKeepHighBytes = 0xFFFFFFFF00000000LL; |
568 | 568 |
569 // Just keep the least significant bits of timestamp, in order to reduce | 569 // Just keep the least significant bits of timestamp, in order to reduce |
570 // probability of collisions. | 570 // probability of collisions. |
571 int64 key = (base::Time::Now().ToInternalValue() & kKeepLowBytes) | | 571 int64 key = (base::Time::Now().ToInternalValue() & kKeepLowBytes) | |
572 (base::RandUint64() & kKeepHighBytes); | 572 (base::RandUint64() & kKeepHighBytes); |
573 return base::HexEncode(reinterpret_cast<void*>(&key), sizeof(key)); | 573 return base::HexEncode(reinterpret_cast<void*>(&key), sizeof(key)); |
574 } | 574 } |
575 | 575 |
576 GoogleStreamingRemoteEngine::FSMEventArgs::FSMEventArgs(FSMEvent event_value) | 576 GoogleStreamingRemoteEngine::FSMEventArgs::FSMEventArgs(FSMEvent event_value) |
577 : event(event_value) { | 577 : event(event_value) { |
578 } | 578 } |
579 | 579 |
580 GoogleStreamingRemoteEngine::FSMEventArgs::~FSMEventArgs() { | 580 GoogleStreamingRemoteEngine::FSMEventArgs::~FSMEventArgs() { |
581 } | 581 } |
582 | 582 |
583 } // namespace content | 583 } // namespace content |
OLD | NEW |