Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: chrome/browser/safe_browsing/protocol_manager.cc

Issue 3007008: Cleanup: Break another common->app dependency. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: minor fix Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/metrics/metrics_log.cc ('k') | chrome/browser/sync/glue/sync_backend_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/env_var.h" 8 #include "base/env_var.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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/stl_util-inl.h" 13 #include "base/stl_util-inl.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/task.h" 15 #include "base/task.h"
16 #include "base/timer.h" 16 #include "base/timer.h"
17 #include "chrome/app/chrome_version_info.h"
18 #include "chrome/browser/chrome_thread.h" 17 #include "chrome/browser/chrome_thread.h"
19 #include "chrome/browser/profile.h" 18 #include "chrome/browser/profile.h"
20 #include "chrome/browser/safe_browsing/protocol_parser.h" 19 #include "chrome/browser/safe_browsing/protocol_parser.h"
21 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 20 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
21 #include "chrome/common/chrome_version_info.h"
22 #include "chrome/common/env_vars.h" 22 #include "chrome/common/env_vars.h"
23 #include "chrome/common/net/url_request_context_getter.h" 23 #include "chrome/common/net/url_request_context_getter.h"
24 #include "net/base/escape.h" 24 #include "net/base/escape.h"
25 #include "net/base/load_flags.h" 25 #include "net/base/load_flags.h"
26 #include "net/url_request/url_request_status.h" 26 #include "net/url_request/url_request_status.h"
27 27
28 using base::Time; 28 using base::Time;
29 using base::TimeDelta; 29 using base::TimeDelta;
30 30
31 // Maximum time, in seconds, from start up before we must issue an update query. 31 // Maximum time, in seconds, from start up before we must issue an update query.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 info_url_prefix_(info_url_prefix), 67 info_url_prefix_(info_url_prefix),
68 mackey_url_prefix_(mackey_url_prefix), 68 mackey_url_prefix_(mackey_url_prefix),
69 disable_auto_update_(disable_auto_update) { 69 disable_auto_update_(disable_auto_update) {
70 DCHECK(!info_url_prefix_.empty() && !mackey_url_prefix_.empty()); 70 DCHECK(!info_url_prefix_.empty() && !mackey_url_prefix_.empty());
71 71
72 // Set the backoff multiplier fuzz to a random value between 0 and 1. 72 // Set the backoff multiplier fuzz to a random value between 0 and 1.
73 back_off_fuzz_ = static_cast<float>(base::RandDouble()); 73 back_off_fuzz_ = static_cast<float>(base::RandDouble());
74 // The first update must happen between 1-5 minutes of start up. 74 // The first update must happen between 1-5 minutes of start up.
75 next_update_sec_ = base::RandInt(60, kSbTimerStartIntervalSec); 75 next_update_sec_ = base::RandInt(60, kSbTimerStartIntervalSec);
76 76
77 scoped_ptr<FileVersionInfo> version_info(chrome_app::GetChromeVersionInfo()); 77 scoped_ptr<FileVersionInfo> version_info(chrome::GetChromeVersionInfo());
78 if (!version_info.get()) 78 if (!version_info.get())
79 version_ = "0.1"; 79 version_ = "0.1";
80 else 80 else
81 version_ = WideToASCII(version_info->product_version()); 81 version_ = WideToASCII(version_info->product_version());
82 } 82 }
83 83
84 SafeBrowsingProtocolManager::~SafeBrowsingProtocolManager() { 84 SafeBrowsingProtocolManager::~SafeBrowsingProtocolManager() {
85 // Delete in-progress SafeBrowsing requests. 85 // Delete in-progress SafeBrowsing requests.
86 STLDeleteContainerPairFirstPointers(hash_requests_.begin(), 86 STLDeleteContainerPairFirstPointers(hash_requests_.begin(),
87 hash_requests_.end()); 87 hash_requests_.end());
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_log.cc ('k') | chrome/browser/sync/glue/sync_backend_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698