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

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

Issue 2546533003: Respect QuicAllowed policy for new streams (Closed)
Patch Set: Move ApplySettingsOnIOThread out of NetHttpSessionParamsObserver Created 3 years, 11 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/safe_browsing_service.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 // Implementation for net::UrlRequestContextGetter. 133 // Implementation for net::UrlRequestContextGetter.
134 net::URLRequestContext* GetURLRequestContext() override; 134 net::URLRequestContext* GetURLRequestContext() override;
135 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() 135 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner()
136 const override; 136 const override;
137 137
138 // Shuts down any pending requests using the getter, and sets |shut_down_| to 138 // Shuts down any pending requests using the getter, and sets |shut_down_| to
139 // true. 139 // true.
140 void ServiceShuttingDown(); 140 void ServiceShuttingDown();
141 141
142 void UpdateNetParamsOnIOThread(
143 net::HttpNetworkSession::ParamsUpdate params_update);
144
142 protected: 145 protected:
143 ~SafeBrowsingURLRequestContextGetter() override; 146 ~SafeBrowsingURLRequestContextGetter() override;
144 147
145 private: 148 private:
146 bool shut_down_; 149 bool shut_down_;
147 150
148 scoped_refptr<net::URLRequestContextGetter> system_context_getter_; 151 scoped_refptr<net::URLRequestContextGetter> system_context_getter_;
149 152
150 std::unique_ptr<net::CookieStore> safe_browsing_cookie_store_; 153 std::unique_ptr<net::CookieStore> safe_browsing_cookie_store_;
151 154
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 235 }
233 236
234 void SafeBrowsingURLRequestContextGetter::ServiceShuttingDown() { 237 void SafeBrowsingURLRequestContextGetter::ServiceShuttingDown() {
235 DCHECK_CURRENTLY_ON(BrowserThread::IO); 238 DCHECK_CURRENTLY_ON(BrowserThread::IO);
236 239
237 shut_down_ = true; 240 shut_down_ = true;
238 URLRequestContextGetter::NotifyContextShuttingDown(); 241 URLRequestContextGetter::NotifyContextShuttingDown();
239 safe_browsing_request_context_.reset(); 242 safe_browsing_request_context_.reset();
240 } 243 }
241 244
245 void SafeBrowsingURLRequestContextGetter::UpdateNetParamsOnIOThread(
246 net::HttpNetworkSession::ParamsUpdate params_update) {
247 DCHECK_CURRENTLY_ON(BrowserThread::IO);
248
249 if (http_network_session_)
250 http_network_session_->UpdateParams(params_update);
251 }
252
242 SafeBrowsingURLRequestContextGetter::~SafeBrowsingURLRequestContextGetter() {} 253 SafeBrowsingURLRequestContextGetter::~SafeBrowsingURLRequestContextGetter() {}
243 254
244 // static 255 // static
245 SafeBrowsingServiceFactory* SafeBrowsingService::factory_ = NULL; 256 SafeBrowsingServiceFactory* SafeBrowsingService::factory_ = NULL;
246 257
247 // The default SafeBrowsingServiceFactory. Global, made a singleton so we 258 // The default SafeBrowsingServiceFactory. Global, made a singleton so we
248 // don't leak it. 259 // don't leak it.
249 class SafeBrowsingServiceFactoryImpl : public SafeBrowsingServiceFactory { 260 class SafeBrowsingServiceFactoryImpl : public SafeBrowsingServiceFactory {
250 public: 261 public:
251 SafeBrowsingService* CreateSafeBrowsingService() override { 262 SafeBrowsingService* CreateSafeBrowsingService() override {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 return false; 397 return false;
387 #endif 398 #endif
388 } 399 }
389 400
390 scoped_refptr<net::URLRequestContextGetter> 401 scoped_refptr<net::URLRequestContextGetter>
391 SafeBrowsingService::url_request_context() { 402 SafeBrowsingService::url_request_context() {
392 DCHECK_CURRENTLY_ON(BrowserThread::UI); 403 DCHECK_CURRENTLY_ON(BrowserThread::UI);
393 return url_request_context_getter_; 404 return url_request_context_getter_;
394 } 405 }
395 406
407 void SafeBrowsingService::UpdateNetParams(
408 net::HttpNetworkSession::ParamsUpdate params_update) {
409 DCHECK_CURRENTLY_ON(BrowserThread::UI);
410
411 BrowserThread::PostTask(
412 BrowserThread::IO, FROM_HERE,
413 base::Bind(
414 &SafeBrowsingURLRequestContextGetter::UpdateNetParamsOnIOThread,
415 base::RetainedRef(url_request_context_getter_), params_update));
416 }
417
418 // TODO(ntfschr): componentize this once BaseSafeBrowsingUIManager contains a
419 // SafeBrowsingService
396 const scoped_refptr<SafeBrowsingUIManager>& 420 const scoped_refptr<SafeBrowsingUIManager>&
397 SafeBrowsingService::ui_manager() const { 421 SafeBrowsingService::ui_manager() const {
398 return ui_manager_; 422 return ui_manager_;
399 } 423 }
400 424
401 const scoped_refptr<SafeBrowsingDatabaseManager>& 425 const scoped_refptr<SafeBrowsingDatabaseManager>&
402 SafeBrowsingService::database_manager() const { 426 SafeBrowsingService::database_manager() const {
403 return enabled_v4_only_ ? v4_local_database_manager() : database_manager_; 427 return enabled_v4_only_ ? v4_local_database_manager() : database_manager_;
404 } 428 }
405 429
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 ping_manager()->ReportThreatDetails(report); 764 ping_manager()->ReportThreatDetails(report);
741 } 765 }
742 766
743 void SafeBrowsingService::ProcessResourceRequest( 767 void SafeBrowsingService::ProcessResourceRequest(
744 const ResourceRequestInfo& request) { 768 const ResourceRequestInfo& request) {
745 DCHECK_CURRENTLY_ON(BrowserThread::UI); 769 DCHECK_CURRENTLY_ON(BrowserThread::UI);
746 services_delegate_->ProcessResourceRequest(&request); 770 services_delegate_->ProcessResourceRequest(&request);
747 } 771 }
748 772
749 } // namespace safe_browsing 773 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698