| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/safe_browsing/protocol_manager.h" | 5 #include "chrome/browser/safe_browsing/protocol_manager.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 default: | 412 default: |
| 413 return false; | 413 return false; |
| 414 } | 414 } |
| 415 | 415 |
| 416 return true; | 416 return true; |
| 417 } | 417 } |
| 418 | 418 |
| 419 void SafeBrowsingProtocolManager::Initialize() { | 419 void SafeBrowsingProtocolManager::Initialize() { |
| 420 // Don't want to hit the safe browsing servers on build/chrome bots. | 420 // Don't want to hit the safe browsing servers on build/chrome bots. |
| 421 scoped_ptr<base::Environment> env(base::Environment::Create()); | 421 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 422 if (env->HasEnv(env_vars::kHeadless)) | 422 if (env->HasVar(env_vars::kHeadless)) |
| 423 return; | 423 return; |
| 424 | 424 |
| 425 ScheduleNextUpdate(false /* no back off */); | 425 ScheduleNextUpdate(false /* no back off */); |
| 426 } | 426 } |
| 427 | 427 |
| 428 void SafeBrowsingProtocolManager::ScheduleNextUpdate(bool back_off) { | 428 void SafeBrowsingProtocolManager::ScheduleNextUpdate(bool back_off) { |
| 429 DCHECK_GT(next_update_sec_, 0); | 429 DCHECK_GT(next_update_sec_, 0); |
| 430 | 430 |
| 431 if (disable_auto_update_) { | 431 if (disable_auto_update_) { |
| 432 // Unschedule any current timer. | 432 // Unschedule any current timer. |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 if (!StartsWithASCII(url, "http://", false) && | 692 if (!StartsWithASCII(url, "http://", false) && |
| 693 !StartsWithASCII(url, "https://", false)) { | 693 !StartsWithASCII(url, "https://", false)) { |
| 694 next_url = "http://" + url; | 694 next_url = "http://" + url; |
| 695 } else { | 695 } else { |
| 696 next_url = url; | 696 next_url = url; |
| 697 } | 697 } |
| 698 if (!additional_query_.empty()) | 698 if (!additional_query_.empty()) |
| 699 next_url += additional_query_; | 699 next_url += additional_query_; |
| 700 return GURL(next_url); | 700 return GURL(next_url); |
| 701 } | 701 } |
| OLD | NEW |