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

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

Issue 11784038: Add backup URL support for SafeBrowsing data requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reduce duplication in comments Created 7 years, 11 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
OLDNEW
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 "chrome/browser/safe_browsing/safe_browsing_service.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 namespace { 51 namespace {
52 52
53 // Filename suffix for the cookie database. 53 // Filename suffix for the cookie database.
54 const FilePath::CharType kCookiesFile[] = FILE_PATH_LITERAL(" Cookies"); 54 const FilePath::CharType kCookiesFile[] = FILE_PATH_LITERAL(" Cookies");
55 55
56 // The default URL prefix where browser fetches chunk updates, hashes, 56 // The default URL prefix where browser fetches chunk updates, hashes,
57 // and reports safe browsing hits and malware details. 57 // and reports safe browsing hits and malware details.
58 const char* const kSbDefaultURLPrefix = 58 const char* const kSbDefaultURLPrefix =
59 "https://safebrowsing.google.com/safebrowsing"; 59 "https://safebrowsing.google.com/safebrowsing";
60 60
61 // The backup URL prefix used when there are issues establishing a connection
62 // with the server at the primary URL.
63 const char* const kSbBackupConnectErrorURLPrefix =
64 "https://alt1-safebrowsing.google.com/safebrowsing";
65
66 // The backup URL prefix used when there are HTTP-specific issues with the
67 // server at the primary URL.
68 const char* const kSbBackupHttpErrorURLPrefix =
69 "https://alt2-safebrowsing.google.com/safebrowsing";
70
71 // The backup URL prefix used when there are local network specific issues.
72 const char* const kSbBackupNetworkErrorURLPrefix =
73 "https://alt3-safebrowsing.google.com/safebrowsing";
noelutz 2013/01/15 01:46:49 Just curious. In the CL description you mention th
noelutz 2013/01/15 18:04:07 Still curious about that ;).
cbentzel 2013/01/22 20:04:30 Sorry - it may be reasonable to do a raw IP only.
74
61 FilePath CookieFilePath() { 75 FilePath CookieFilePath() {
62 return FilePath( 76 return FilePath(
63 SafeBrowsingService::GetBaseFilename().value() + kCookiesFile); 77 SafeBrowsingService::GetBaseFilename().value() + kCookiesFile);
64 } 78 }
65 79
66 } // namespace 80 } // namespace
67 81
68 class SafeBrowsingURLRequestContextGetter 82 class SafeBrowsingURLRequestContextGetter
69 : public net::URLRequestContextGetter { 83 : public net::URLRequestContextGetter {
70 public: 84 public:
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 #endif 348 #endif
335 #endif 349 #endif
336 CommandLine* cmdline = CommandLine::ForCurrentProcess(); 350 CommandLine* cmdline = CommandLine::ForCurrentProcess();
337 config.disable_auto_update = 351 config.disable_auto_update =
338 cmdline->HasSwitch(switches::kSbDisableAutoUpdate) || 352 cmdline->HasSwitch(switches::kSbDisableAutoUpdate) ||
339 cmdline->HasSwitch(switches::kDisableBackgroundNetworking); 353 cmdline->HasSwitch(switches::kDisableBackgroundNetworking);
340 config.url_prefix = 354 config.url_prefix =
341 cmdline->HasSwitch(switches::kSbURLPrefix) ? 355 cmdline->HasSwitch(switches::kSbURLPrefix) ?
342 cmdline->GetSwitchValueASCII(switches::kSbURLPrefix) : 356 cmdline->GetSwitchValueASCII(switches::kSbURLPrefix) :
343 kSbDefaultURLPrefix; 357 kSbDefaultURLPrefix;
358 config.backup_connect_error_url_prefix = kSbBackupConnectErrorURLPrefix;
359 config.backup_http_error_url_prefix = kSbBackupHttpErrorURLPrefix;
360 config.backup_network_error_url_prefix = kSbBackupNetworkErrorURLPrefix;
344 361
345 #if defined(FULL_SAFE_BROWSING) 362 #if defined(FULL_SAFE_BROWSING)
346 DCHECK(database_manager_); 363 DCHECK(database_manager_);
347 database_manager_->StartOnIOThread(); 364 database_manager_->StartOnIOThread();
348 365
349 DCHECK(!protocol_manager_); 366 DCHECK(!protocol_manager_);
350 protocol_manager_ = 367 protocol_manager_ =
351 SafeBrowsingProtocolManager::Create(database_manager_, 368 SafeBrowsingProtocolManager::Create(database_manager_,
352 url_request_context_getter_, 369 url_request_context_getter_,
353 config); 370 config);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 #if defined(FULL_SAFE_BROWSING) 477 #if defined(FULL_SAFE_BROWSING)
461 if (csd_service_.get()) 478 if (csd_service_.get())
462 csd_service_->SetEnabledAndRefreshState(enable); 479 csd_service_->SetEnabledAndRefreshState(enable);
463 if (download_service_.get()) { 480 if (download_service_.get()) {
464 download_service_->SetEnabled( 481 download_service_->SetEnabled(
465 enable && !CommandLine::ForCurrentProcess()->HasSwitch( 482 enable && !CommandLine::ForCurrentProcess()->HasSwitch(
466 switches::kDisableImprovedDownloadProtection)); 483 switches::kDisableImprovedDownloadProtection));
467 } 484 }
468 #endif 485 #endif
469 } 486 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698