| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/internal_auth.h" | 5 #include "chrome/browser/internal_auth.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 GenerateNewKey(); | 340 GenerateNewKey(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 void GenerateNewKey() { | 343 void GenerateNewKey() { |
| 344 DCHECK(CalledOnValidThread()); | 344 DCHECK(CalledOnValidThread()); |
| 345 if (!timer_.IsRunning()) { | 345 if (!timer_.IsRunning()) { |
| 346 timer_.Start( | 346 timer_.Start( |
| 347 base::TimeDelta::FromMicroseconds( | 347 base::TimeDelta::FromMicroseconds( |
| 348 kKeyRegenerationSoftTicks * kTickUs), | 348 kKeyRegenerationSoftTicks * kTickUs), |
| 349 this, | 349 this, |
| 350 &InternalAuthGenerationService::GenerateNewKey); | 350 &InternalAuthGenerationService::GenerateNewKey, |
| 351 FROM_HERE); |
| 351 } | 352 } |
| 352 | 353 |
| 353 scoped_ptr<crypto::HMAC> new_engine( | 354 scoped_ptr<crypto::HMAC> new_engine( |
| 354 new crypto::HMAC(crypto::HMAC::SHA256)); | 355 new crypto::HMAC(crypto::HMAC::SHA256)); |
| 355 std::string key = base::RandBytesAsString(kKeySizeInBytes); | 356 std::string key = base::RandBytesAsString(kKeySizeInBytes); |
| 356 if (!new_engine->Init(key)) | 357 if (!new_engine->Init(key)) |
| 357 return; | 358 return; |
| 358 engine_.swap(new_engine); | 359 engine_.swap(new_engine); |
| 359 key_regeneration_tick_ = GetCurrentTick(); | 360 key_regeneration_tick_ = GetCurrentTick(); |
| 360 g_verification_service.Get().ChangeKey(key); | 361 g_verification_service.Get().ChangeKey(key); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 return g_generation_service.Get().GeneratePassport(domain, var_value_map, 0); | 478 return g_generation_service.Get().GeneratePassport(domain, var_value_map, 0); |
| 478 } | 479 } |
| 479 | 480 |
| 480 // static | 481 // static |
| 481 void InternalAuthGeneration::GenerateNewKey() { | 482 void InternalAuthGeneration::GenerateNewKey() { |
| 482 g_generation_service.Get().GenerateNewKey(); | 483 g_generation_service.Get().GenerateNewKey(); |
| 483 } | 484 } |
| 484 | 485 |
| 485 } // namespace browser | 486 } // namespace browser |
| 486 | 487 |
| OLD | NEW |