Chromium Code Reviews| Index: chrome/browser/safe_browsing/protocol_manager.cc |
| =================================================================== |
| --- chrome/browser/safe_browsing/protocol_manager.cc (revision 2544) |
| +++ chrome/browser/safe_browsing/protocol_manager.cc (working copy) |
| @@ -7,15 +7,15 @@ |
| #include "base/histogram.h" |
| #include "base/logging.h" |
| #include "base/message_loop.h" |
| +#include "base/rand_util.h" |
| #include "base/string_util.h" |
| +#include "base/sys_info.h" |
| #include "base/task.h" |
| #include "base/timer.h" |
| #include "chrome/browser/profile.h" |
| #include "chrome/browser/safe_browsing/protocol_parser.h" |
| #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| -#include "chrome/common/env_util.h" |
| #include "chrome/common/env_vars.h" |
| -#include "chrome/common/rand_util.h" |
| #include "chrome/common/stl_util-inl.h" |
| #include "net/base/base64.h" |
| #include "net/base/load_flags.h" |
| @@ -69,10 +69,10 @@ |
| client_key_(client_key), |
| wrapped_key_(wrapped_key) { |
| // Set the backoff multiplier fuzz to a random value between 0 and 1. |
| - back_off_fuzz_ = static_cast<float>(rand_util::RandInt(1, INT_MAX)) / INT_MAX; |
| + back_off_fuzz_ = base::RandDouble(); |
|
Mark Mentovai
2008/09/29 22:20:05
MSVC still requires static_cast<float> here, "poss
|
| // The first update must happen between 0-5 minutes of start up. |
| - next_update_sec_ = rand_util::RandInt(60, kSbTimerStartIntervalSec); |
| + next_update_sec_ = base::RandInt(60, kSbTimerStartIntervalSec); |
| } |
| SafeBrowsingProtocolManager::~SafeBrowsingProtocolManager() { |
| @@ -276,7 +276,7 @@ |
| if (next_update_sec > 0) { |
| next_update_sec_ = next_update_sec; |
| } else if (update_state_ == SECOND_REQUEST) { |
| - next_update_sec_ = rand_util::RandInt(15, 45) * 60; |
| + next_update_sec_ = base::RandInt(15 * 60, 45 * 60); |
| } |
| // We need to request a new set of keys for MAC. |
| @@ -372,7 +372,7 @@ |
| void SafeBrowsingProtocolManager::Initialize() { |
| // Don't want to hit the safe browsing servers on build/chrome bots. |
| - if (env_util::HasEnvironmentVariable(env_vars::kHeadless)) |
| + if (base::SysInfo::HasEnvironmentVariable(env_vars::kHeadless)) |
|
Mark Mentovai
2008/09/29 22:20:05
env_vars::kHeadless is a const wchar_t*, but HasEn
|
| return; |
| ScheduleNextUpdate(false /* no back off */); |