| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // Can be called on the UI thread, returns if QUIC is enabled for new streams in | 50 // Can be called on the UI thread, returns if QUIC is enabled for new streams in |
| 51 // the passed |request_context_getter|. | 51 // the passed |request_context_getter|. |
| 52 bool IsQuicEnabled( | 52 bool IsQuicEnabled( |
| 53 scoped_refptr<net::URLRequestContextGetter> request_context_getter) { | 53 scoped_refptr<net::URLRequestContextGetter> request_context_getter) { |
| 54 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 54 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 55 | 55 |
| 56 base::RunLoop run_loop; | 56 base::RunLoop run_loop; |
| 57 bool is_quic_enabled = false; | 57 bool is_quic_enabled = false; |
| 58 content::BrowserThread::PostTaskAndReply( | 58 content::BrowserThread::PostTaskAndReply( |
| 59 content::BrowserThread::IO, FROM_HERE, | 59 content::BrowserThread::IO, FROM_HERE, |
| 60 base::Bind(IsQuicEnabledOnIOThread, request_context_getter, | 60 base::BindOnce(IsQuicEnabledOnIOThread, request_context_getter, |
| 61 &is_quic_enabled), | 61 &is_quic_enabled), |
| 62 run_loop.QuitClosure()); | 62 run_loop.QuitClosure()); |
| 63 run_loop.Run(); | 63 run_loop.Run(); |
| 64 return is_quic_enabled; | 64 return is_quic_enabled; |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Short-hand access to global SafeBrowsingService's URLRequestContextGetter for | 67 // Short-hand access to global SafeBrowsingService's URLRequestContextGetter for |
| 68 // better readability. | 68 // better readability. |
| 69 scoped_refptr<net::URLRequestContextGetter> | 69 scoped_refptr<net::URLRequestContextGetter> |
| 70 safe_browsing_service_request_context() { | 70 safe_browsing_service_request_context() { |
| 71 return g_browser_process->safe_browsing_service()->url_request_context(); | 71 return g_browser_process->safe_browsing_service()->url_request_context(); |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 406 |
| 407 // Disable QUIC in second profile | 407 // Disable QUIC in second profile |
| 408 SetQuicAllowedPolicy(policy_for_profile_2(), false); | 408 SetQuicAllowedPolicy(policy_for_profile_2(), false); |
| 409 EXPECT_FALSE(IsQuicEnabled(system_request_context())); | 409 EXPECT_FALSE(IsQuicEnabled(system_request_context())); |
| 410 EXPECT_FALSE(IsQuicEnabled(safe_browsing_service_request_context())); | 410 EXPECT_FALSE(IsQuicEnabled(safe_browsing_service_request_context())); |
| 411 EXPECT_FALSE(IsQuicEnabled(profile_1()->GetRequestContext())); | 411 EXPECT_FALSE(IsQuicEnabled(profile_1()->GetRequestContext())); |
| 412 EXPECT_FALSE(IsQuicEnabled(profile_2()->GetRequestContext())); | 412 EXPECT_FALSE(IsQuicEnabled(profile_2()->GetRequestContext())); |
| 413 } | 413 } |
| 414 | 414 |
| 415 } // namespace policy | 415 } // namespace policy |
| OLD | NEW |