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

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

Issue 1726403006: Switch Safe Browsing's metadata from string to struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mattm's comments Created 4 years, 10 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/ui_manager.h" 5 #include "chrome/browser/safe_browsing/ui_manager.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/debug/leak_tracker.h" 10 #include "base/debug/leak_tracker.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 void SafeBrowsingUIManager::DisplayBlockingPage( 146 void SafeBrowsingUIManager::DisplayBlockingPage(
147 const UnsafeResource& resource) { 147 const UnsafeResource& resource) {
148 DCHECK_CURRENTLY_ON(BrowserThread::UI); 148 DCHECK_CURRENTLY_ON(BrowserThread::UI);
149 if (resource.is_subresource && !resource.is_subframe) { 149 if (resource.is_subresource && !resource.is_subframe) {
150 // Sites tagged as serving Unwanted Software should only show a warning for 150 // Sites tagged as serving Unwanted Software should only show a warning for
151 // main-frame or sub-frame resource. Similar warning restrictions should be 151 // main-frame or sub-frame resource. Similar warning restrictions should be
152 // applied to malware sites tagged as "landing sites" (see "Types of 152 // applied to malware sites tagged as "landing sites" (see "Types of
153 // Malware sites" under 153 // Malware sites" under
154 // https://developers.google.com/safe-browsing/developers_guide_v3#UserWarni ngs). 154 // https://developers.google.com/safe-browsing/developers_guide_v3#UserWarni ngs).
155 // TODO(nparker): Replace the use of raw_metadata when other fields are
156 // populated. crbug/589610
155 MalwarePatternType proto; 157 MalwarePatternType proto;
156 if (resource.threat_type == SB_THREAT_TYPE_URL_UNWANTED || 158 if (resource.threat_type == SB_THREAT_TYPE_URL_UNWANTED ||
157 (resource.threat_type == SB_THREAT_TYPE_URL_MALWARE && 159 (resource.threat_type == SB_THREAT_TYPE_URL_MALWARE &&
158 !resource.threat_metadata.empty() && 160 !resource.threat_metadata.raw_metadata.empty() &&
159 proto.ParseFromString(resource.threat_metadata) && 161 proto.ParseFromString(resource.threat_metadata.raw_metadata) &&
160 proto.pattern_type() == MalwarePatternType::LANDING)) { 162 proto.pattern_type() == MalwarePatternType::LANDING)) {
161 if (!resource.callback.is_null()) { 163 if (!resource.callback.is_null()) {
162 DCHECK(resource.callback_thread); 164 DCHECK(resource.callback_thread);
163 resource.callback_thread->PostTask(FROM_HERE, 165 resource.callback_thread->PostTask(FROM_HERE,
164 base::Bind(resource.callback, true)); 166 base::Bind(resource.callback, true));
165 } 167 }
166 168
167 return; 169 return;
168 } 170 }
169 } 171 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 } 364 }
363 365
364 WhitelistUrlSet* site_list = 366 WhitelistUrlSet* site_list =
365 static_cast<WhitelistUrlSet*>(web_contents->GetUserData(kWhitelistKey)); 367 static_cast<WhitelistUrlSet*>(web_contents->GetUserData(kWhitelistKey));
366 if (!site_list) 368 if (!site_list)
367 return false; 369 return false;
368 return site_list->Contains(maybe_whitelisted_url); 370 return site_list->Contains(maybe_whitelisted_url);
369 } 371 }
370 372
371 } // namespace safe_browsing 373 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698