| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 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/activation_state_computi
ng_navigation_throttle.h" | 5 #include "components/subresource_filter/content/browser/activation_state_computi
ng_navigation_throttle.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 async_filter_ = base::MakeUnique<AsyncDocumentSubresourceFilter>( | 92 async_filter_ = base::MakeUnique<AsyncDocumentSubresourceFilter>( |
| 93 ruleset_handle_, std::move(params), | 93 ruleset_handle_, std::move(params), |
| 94 base::Bind(&ActivationStateComputingNavigationThrottle:: | 94 base::Bind(&ActivationStateComputingNavigationThrottle:: |
| 95 OnActivationStateComputed, | 95 OnActivationStateComputed, |
| 96 weak_ptr_factory_.GetWeakPtr())); | 96 weak_ptr_factory_.GetWeakPtr())); |
| 97 return content::NavigationThrottle::ThrottleCheckResult::DEFER; | 97 return content::NavigationThrottle::ThrottleCheckResult::DEFER; |
| 98 } | 98 } |
| 99 | 99 |
| 100 const char* ActivationStateComputingNavigationThrottle::GetNameForLogging() { |
| 101 return "ActivationStateComputingNavigationThrottle"; |
| 102 } |
| 103 |
| 100 void ActivationStateComputingNavigationThrottle::OnActivationStateComputed( | 104 void ActivationStateComputingNavigationThrottle::OnActivationStateComputed( |
| 101 ActivationState state) { | 105 ActivationState state) { |
| 102 navigation_handle()->Resume(); | 106 navigation_handle()->Resume(); |
| 103 } | 107 } |
| 104 | 108 |
| 105 // Ensure the caller cannot take ownership of a subresource filter for cases | 109 // Ensure the caller cannot take ownership of a subresource filter for cases |
| 106 // when activation IPCs are not sent to the render process. | 110 // when activation IPCs are not sent to the render process. |
| 107 std::unique_ptr<AsyncDocumentSubresourceFilter> | 111 std::unique_ptr<AsyncDocumentSubresourceFilter> |
| 108 ActivationStateComputingNavigationThrottle::ReleaseFilter() { | 112 ActivationStateComputingNavigationThrottle::ReleaseFilter() { |
| 109 return will_send_activation_to_renderer_ ? std::move(async_filter_) : nullptr; | 113 return will_send_activation_to_renderer_ ? std::move(async_filter_) : nullptr; |
| 110 } | 114 } |
| 111 | 115 |
| 112 void ActivationStateComputingNavigationThrottle:: | 116 void ActivationStateComputingNavigationThrottle:: |
| 113 WillSendActivationToRenderer() { | 117 WillSendActivationToRenderer() { |
| 114 DCHECK(async_filter_); | 118 DCHECK(async_filter_); |
| 115 will_send_activation_to_renderer_ = true; | 119 will_send_activation_to_renderer_ = true; |
| 116 } | 120 } |
| 117 | 121 |
| 118 } // namespace subresource_filter | 122 } // namespace subresource_filter |
| OLD | NEW |