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

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

Issue 1348683003: enable download protection on CrOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years, 2 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
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/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 return; 662 return;
663 } 663 }
664 } 664 }
665 } 665 }
666 666
667 if (!pingback_enabled_) { 667 if (!pingback_enabled_) {
668 PostFinishTask(UNKNOWN, REASON_PING_DISABLED); 668 PostFinishTask(UNKNOWN, REASON_PING_DISABLED);
669 return; 669 return;
670 } 670 }
671 671
672 // Currently, the UI is only enabled on Windows and OSX so we don't even 672 // Currently, the UI is enabled on Windows, OSX and chrome OS. we don't ping
673 // bother with pinging the server if we're not on one of those platforms. 673 // the server if we're not on one of those platforms.
674 // TODO(noelutz): change this code once the UI is done for Linux. 674 // TODO(noelutz): change this code once the UI is done for Linux.
675 #if defined(OS_WIN) || defined(OS_MACOSX) 675 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
676 // The URLFetcher is owned by the UI thread, so post a message to 676 // The URLFetcher is owned by the UI thread, so post a message to
677 // start the pingback. 677 // start the pingback.
678 BrowserThread::PostTask( 678 BrowserThread::PostTask(
679 BrowserThread::UI, 679 BrowserThread::UI,
680 FROM_HERE, 680 FROM_HERE,
681 base::Bind(&CheckClientDownloadRequest::GetTabRedirects, this)); 681 base::Bind(&CheckClientDownloadRequest::GetTabRedirects, this));
682 #else 682 #else
683 PostFinishTask(UNKNOWN, REASON_OS_NOT_SUPPORTED); 683 PostFinishTask(UNKNOWN, REASON_OS_NOT_SUPPORTED);
684 #endif 684 #endif
685 } 685 }
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 // The client will release itself once it is done. 1010 // The client will release itself once it is done.
1011 BrowserThread::PostTask( 1011 BrowserThread::PostTask(
1012 BrowserThread::IO, 1012 BrowserThread::IO,
1013 FROM_HERE, 1013 FROM_HERE,
1014 base::Bind(&DownloadUrlSBClient::StartCheck, client)); 1014 base::Bind(&DownloadUrlSBClient::StartCheck, client));
1015 } 1015 }
1016 1016
1017 bool DownloadProtectionService::IsSupportedDownload( 1017 bool DownloadProtectionService::IsSupportedDownload(
1018 const content::DownloadItem& item, 1018 const content::DownloadItem& item,
1019 const base::FilePath& target_path) const { 1019 const base::FilePath& target_path) const {
1020 // Currently, the UI is only enabled on Windows and OSX. On Linux we still 1020 // Currently, the UI is only enabled on Windows, OSX and Chrome OS. On
1021 // want to show the dangerous file type warning if the file is possibly 1021 // Linux we still want to show the dangerous file type warning if the file
1022 // dangerous which means we have to always return false here. 1022 // is possibly dangerous which means we have to always return false here.
1023 #if defined(OS_WIN) || defined(OS_MACOSX) 1023 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
1024 DownloadCheckResultReason reason = REASON_MAX; 1024 DownloadCheckResultReason reason = REASON_MAX;
1025 ClientDownloadRequest::DownloadType type = 1025 ClientDownloadRequest::DownloadType type =
1026 ClientDownloadRequest::WIN_EXECUTABLE; 1026 ClientDownloadRequest::WIN_EXECUTABLE;
1027 return (CheckClientDownloadRequest::IsSupportedDownload( 1027 return (CheckClientDownloadRequest::IsSupportedDownload(
1028 item, target_path, &reason, &type) && 1028 item, target_path, &reason, &type) &&
1029 (ClientDownloadRequest::CHROME_EXTENSION != type)); 1029 (ClientDownloadRequest::CHROME_EXTENSION != type));
1030 #else 1030 #else
1031 return false; 1031 return false;
1032 #endif 1032 #endif
1033 } 1033 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 GURL DownloadProtectionService::GetDownloadRequestUrl() { 1157 GURL DownloadProtectionService::GetDownloadRequestUrl() {
1158 GURL url(kDownloadRequestUrl); 1158 GURL url(kDownloadRequestUrl);
1159 std::string api_key = google_apis::GetAPIKey(); 1159 std::string api_key = google_apis::GetAPIKey();
1160 if (!api_key.empty()) 1160 if (!api_key.empty())
1161 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); 1161 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true));
1162 1162
1163 return url; 1163 return url;
1164 } 1164 }
1165 1165
1166 } // namespace safe_browsing 1166 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698