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

Side by Side Diff: components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc

Issue 2830353003: Tracing for NavigationHandle lifetime and state. (Closed)
Patch Set: Rebase. Created 3 years, 8 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) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 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 "components/subresource_filter/content/browser/subresource_filter_safe_ browsing_activation_throttle.h" 5 #include "components/subresource_filter/content/browser/subresource_filter_safe_ browsing_activation_throttle.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "components/safe_browsing_db/v4_local_database_manager.h" 10 #include "components/safe_browsing_db/v4_local_database_manager.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 content::NavigationThrottle::ThrottleCheckResult 115 content::NavigationThrottle::ThrottleCheckResult
116 SubresourceFilterSafeBrowsingActivationThrottle::WillProcessResponse() { 116 SubresourceFilterSafeBrowsingActivationThrottle::WillProcessResponse() {
117 io_task_runner_->PostTask( 117 io_task_runner_->PostTask(
118 FROM_HERE, base::Bind(&SubresourceFilterSafeBrowsingActivationThrottle:: 118 FROM_HERE, base::Bind(&SubresourceFilterSafeBrowsingActivationThrottle::
119 SBDatabaseClient::CheckUrlOnIO, 119 SBDatabaseClient::CheckUrlOnIO,
120 base::Unretained(database_client_.get()), 120 base::Unretained(database_client_.get()),
121 navigation_handle()->GetURL())); 121 navigation_handle()->GetURL()));
122 return content::NavigationThrottle::ThrottleCheckResult::DEFER; 122 return content::NavigationThrottle::ThrottleCheckResult::DEFER;
123 } 123 }
124 124
125 const char*
126 SubresourceFilterSafeBrowsingActivationThrottle::GetNameForLogging() {
127 return "SubresourceFilterSafeBrowsingActivationThrottle";
128 }
129
125 void SubresourceFilterSafeBrowsingActivationThrottle::OnCheckUrlResultOnUI( 130 void SubresourceFilterSafeBrowsingActivationThrottle::OnCheckUrlResultOnUI(
126 const GURL& url, 131 const GURL& url,
127 safe_browsing::SBThreatType threat_type, 132 safe_browsing::SBThreatType threat_type,
128 safe_browsing::ThreatPatternType pattern_type) { 133 safe_browsing::ThreatPatternType pattern_type) {
129 content::WebContents* web_contents = navigation_handle()->GetWebContents(); 134 content::WebContents* web_contents = navigation_handle()->GetWebContents();
130 if (web_contents) { 135 if (web_contents) {
131 using subresource_filter::ContentSubresourceFilterDriverFactory; 136 using subresource_filter::ContentSubresourceFilterDriverFactory;
132 ContentSubresourceFilterDriverFactory* driver_factory = 137 ContentSubresourceFilterDriverFactory* driver_factory =
133 ContentSubresourceFilterDriverFactory::FromWebContents(web_contents); 138 ContentSubresourceFilterDriverFactory::FromWebContents(web_contents);
134 DCHECK(driver_factory); 139 DCHECK(driver_factory);
135 140
136 driver_factory->OnMainResourceMatchedSafeBrowsingBlacklist( 141 driver_factory->OnMainResourceMatchedSafeBrowsingBlacklist(
137 url, std::vector<GURL>(), threat_type, pattern_type); 142 url, std::vector<GURL>(), threat_type, pattern_type);
138 } 143 }
139 // TODO(https://crbug.com/704508): We should measure the delay introduces by 144 // TODO(https://crbug.com/704508): We should measure the delay introduces by
140 // this check. Similarly, as it's done the Safe Browsing Resource throttle. 145 // this check. Similarly, as it's done the Safe Browsing Resource throttle.
141 navigation_handle()->Resume(); 146 navigation_handle()->Resume();
142 } 147 }
143 148
144 } // namespace subresource_filter 149 } // namespace subresource_filter
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698