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

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

Issue 10421021: Make DownloadProtectionService not use BrowserList::GetLastActive() to load a link. Instead pass th… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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/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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 void DownloadProtectionService::RequestFinished( 858 void DownloadProtectionService::RequestFinished(
859 CheckClientDownloadRequest* request) { 859 CheckClientDownloadRequest* request) {
860 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 860 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
861 std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it = 861 std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it =
862 download_requests_.find(request); 862 download_requests_.find(request);
863 DCHECK(it != download_requests_.end()); 863 DCHECK(it != download_requests_.end());
864 download_requests_.erase(*it); 864 download_requests_.erase(*it);
865 } 865 }
866 866
867 void DownloadProtectionService::ShowDetailsForDownload( 867 void DownloadProtectionService::ShowDetailsForDownload(
868 const DownloadProtectionService::DownloadInfo& info) { 868 const DownloadProtectionService::DownloadInfo& info,
869 Browser* browser = BrowserList::GetLastActive(); 869 content::PageNavigator* navigator) {
870 DCHECK(browser && browser->is_type_tabbed()); 870 navigator->OpenURL(
871 content::OpenURLParams params(GURL(chrome::kDownloadScanningLearnMoreURL), 871 content::OpenURLParams(GURL(chrome::kDownloadScanningLearnMoreURL),
872 content::Referrer(), NEW_FOREGROUND_TAB, 872 content::Referrer(),
873 content::PAGE_TRANSITION_TYPED, false); 873 NEW_FOREGROUND_TAB,
874 browser->OpenURL(params); 874 content::PAGE_TRANSITION_LINK,
875 false));
875 } 876 }
876 877
877 namespace { 878 namespace {
878 // Escapes a certificate attribute so that it can be used in a whitelist 879 // Escapes a certificate attribute so that it can be used in a whitelist
879 // entry. Currently, we only escape slashes, since they are used as a 880 // entry. Currently, we only escape slashes, since they are used as a
880 // separator between attributes. 881 // separator between attributes.
881 std::string EscapeCertAttribute(const std::string& attribute) { 882 std::string EscapeCertAttribute(const std::string& attribute) {
882 std::string escaped; 883 std::string escaped;
883 for (size_t i = 0; i < attribute.size(); ++i) { 884 for (size_t i = 0; i < attribute.size(); ++i) {
884 if (attribute[i] == '%') { 885 if (attribute[i] == '%') {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 944
944 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data, 945 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data,
945 sizeof(issuer.fingerprint().data)); 946 sizeof(issuer.fingerprint().data));
946 for (std::set<std::string>::iterator it = paths_to_check.begin(); 947 for (std::set<std::string>::iterator it = paths_to_check.begin();
947 it != paths_to_check.end(); ++it) { 948 it != paths_to_check.end(); ++it) {
948 whitelist_strings->push_back("cert/" + issuer_fp + *it); 949 whitelist_strings->push_back("cert/" + issuer_fp + *it);
949 } 950 }
950 } 951 }
951 952
952 } // namespace safe_browsing 953 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698