OLD | NEW |
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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 #if defined(GOOGLE_CHROME_BUILD) | 351 #if defined(GOOGLE_CHROME_BUILD) |
352 config.client_name = "googlechrome"; | 352 config.client_name = "googlechrome"; |
353 #else | 353 #else |
354 config.client_name = "chromium"; | 354 config.client_name = "chromium"; |
355 #endif | 355 #endif |
356 #endif | 356 #endif |
357 CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 357 CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
358 config.disable_auto_update = | 358 config.disable_auto_update = |
359 cmdline->HasSwitch(switches::kSbDisableAutoUpdate) || | 359 cmdline->HasSwitch(switches::kSbDisableAutoUpdate) || |
360 cmdline->HasSwitch(switches::kDisableBackgroundNetworking); | 360 cmdline->HasSwitch(switches::kDisableBackgroundNetworking); |
361 config.url_prefix = | 361 if (cmdline->HasSwitch(switches::kSbURLPrefix)) { |
362 cmdline->HasSwitch(switches::kSbURLPrefix) ? | 362 config.url_prefix = cmdline->GetSwitchValueASCII(switches::kSbURLPrefix); |
363 cmdline->GetSwitchValueASCII(switches::kSbURLPrefix) : | 363 } else { |
364 kSbDefaultURLPrefix; | 364 config.url_prefix = kSbDefaultURLPrefix; |
365 config.backup_connect_error_url_prefix = kSbBackupConnectErrorURLPrefix; | 365 config.backup_connect_error_url_prefix = kSbBackupConnectErrorURLPrefix; |
366 config.backup_http_error_url_prefix = kSbBackupHttpErrorURLPrefix; | 366 config.backup_http_error_url_prefix = kSbBackupHttpErrorURLPrefix; |
367 config.backup_network_error_url_prefix = kSbBackupNetworkErrorURLPrefix; | 367 config.backup_network_error_url_prefix = kSbBackupNetworkErrorURLPrefix; |
| 368 } |
368 | 369 |
369 #if defined(FULL_SAFE_BROWSING) | 370 #if defined(FULL_SAFE_BROWSING) |
370 DCHECK(database_manager_); | 371 DCHECK(database_manager_); |
371 database_manager_->StartOnIOThread(); | 372 database_manager_->StartOnIOThread(); |
372 | 373 |
373 DCHECK(!protocol_manager_); | 374 DCHECK(!protocol_manager_); |
374 protocol_manager_ = | 375 protocol_manager_ = |
375 SafeBrowsingProtocolManager::Create(database_manager_, | 376 SafeBrowsingProtocolManager::Create(database_manager_, |
376 url_request_context_getter_, | 377 url_request_context_getter_, |
377 config); | 378 config); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 #if defined(FULL_SAFE_BROWSING) | 485 #if defined(FULL_SAFE_BROWSING) |
485 if (csd_service_.get()) | 486 if (csd_service_.get()) |
486 csd_service_->SetEnabledAndRefreshState(enable); | 487 csd_service_->SetEnabledAndRefreshState(enable); |
487 if (download_service_.get()) { | 488 if (download_service_.get()) { |
488 download_service_->SetEnabled( | 489 download_service_->SetEnabled( |
489 enable && !CommandLine::ForCurrentProcess()->HasSwitch( | 490 enable && !CommandLine::ForCurrentProcess()->HasSwitch( |
490 switches::kDisableImprovedDownloadProtection)); | 491 switches::kDisableImprovedDownloadProtection)); |
491 } | 492 } |
492 #endif | 493 #endif |
493 } | 494 } |
OLD | NEW |