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

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

Issue 2063863002: Use DCHECKs when observing only a single notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/client_side_detection_service.h" 5 #include "chrome/browser/safe_browsing/client_side_detection_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } else { 217 } else {
218 NOTREACHED(); 218 NOTREACHED();
219 } 219 }
220 } 220 }
221 221
222 void ClientSideDetectionService::Observe( 222 void ClientSideDetectionService::Observe(
223 int type, 223 int type,
224 const content::NotificationSource& source, 224 const content::NotificationSource& source,
225 const content::NotificationDetails& details) { 225 const content::NotificationDetails& details) {
226 DCHECK_CURRENTLY_ON(BrowserThread::UI); 226 DCHECK_CURRENTLY_ON(BrowserThread::UI);
227 DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_CREATED); 227 DCHECK_EQ(content::NOTIFICATION_RENDERER_PROCESS_CREATED, type);
228 SendModelToProcess( 228 SendModelToProcess(
229 content::Source<content::RenderProcessHost>(source).ptr()); 229 content::Source<content::RenderProcessHost>(source).ptr());
230 } 230 }
231 231
232 void ClientSideDetectionService::SendModelToProcess( 232 void ClientSideDetectionService::SendModelToProcess(
233 content::RenderProcessHost* process) { 233 content::RenderProcessHost* process) {
234 // The ClientSideDetectionService is enabled if _any_ active profile has 234 // The ClientSideDetectionService is enabled if _any_ active profile has
235 // SafeBrowsing turned on. Here we check the profile for each renderer 235 // SafeBrowsing turned on. Here we check the profile for each renderer
236 // process and only send the model to those that have SafeBrowsing enabled, 236 // process and only send the model to those that have SafeBrowsing enabled,
237 // and we select the model based on the extended reporting setting. 237 // and we select the model based on the extended reporting setting.
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 const std::string& report_url) { 521 const std::string& report_url) {
522 GURL url(report_url); 522 GURL url(report_url);
523 std::string api_key = google_apis::GetAPIKey(); 523 std::string api_key = google_apis::GetAPIKey();
524 if (!api_key.empty()) 524 if (!api_key.empty())
525 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); 525 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true));
526 526
527 return url; 527 return url;
528 } 528 }
529 529
530 } // namespace safe_browsing 530 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698