| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/content_subresource_filt
er_driver_factory.h" | 5 #include "components/subresource_filter/content/browser/content_subresource_filt
er_driver_factory.h" |
| 6 | 6 |
| 7 #include "base/feature_list.h" | 7 #include "base/feature_list.h" |
| 8 #include "base/memory/ptr_util.h" |
| 8 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| 10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 11 #include "components/subresource_filter/content/browser/content_activation_list_
utils.h" | 12 #include "components/subresource_filter/content/browser/content_activation_list_
utils.h" |
| 12 #include "components/subresource_filter/content/browser/subresource_filter_clien
t.h" | 13 #include "components/subresource_filter/content/browser/subresource_filter_clien
t.h" |
| 13 #include "components/subresource_filter/core/browser/subresource_filter_features
.h" | 14 #include "components/subresource_filter/core/browser/subresource_filter_features
.h" |
| 14 #include "components/subresource_filter/core/common/activation_list.h" | 15 #include "components/subresource_filter/core/common/activation_list.h" |
| 15 #include "components/subresource_filter/core/common/activation_state.h" | 16 #include "components/subresource_filter/core/common/activation_state.h" |
| 16 #include "content/public/browser/navigation_handle.h" | 17 #include "content/public/browser/navigation_handle.h" |
| 17 #include "content/public/browser/navigation_throttle.h" | 18 #include "content/public/browser/navigation_throttle.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } while (0) | 53 } while (0) |
| 53 | 54 |
| 54 } // namespace | 55 } // namespace |
| 55 | 56 |
| 56 // static | 57 // static |
| 57 void ContentSubresourceFilterDriverFactory::CreateForWebContents( | 58 void ContentSubresourceFilterDriverFactory::CreateForWebContents( |
| 58 content::WebContents* web_contents, | 59 content::WebContents* web_contents, |
| 59 std::unique_ptr<SubresourceFilterClient> client) { | 60 std::unique_ptr<SubresourceFilterClient> client) { |
| 60 if (FromWebContents(web_contents)) | 61 if (FromWebContents(web_contents)) |
| 61 return; | 62 return; |
| 62 web_contents->SetUserData(kWebContentsUserDataKey, | 63 web_contents->SetUserData( |
| 63 new ContentSubresourceFilterDriverFactory( | 64 kWebContentsUserDataKey, |
| 64 web_contents, std::move(client))); | 65 base::MakeUnique<ContentSubresourceFilterDriverFactory>( |
| 66 web_contents, std::move(client))); |
| 65 } | 67 } |
| 66 | 68 |
| 67 // static | 69 // static |
| 68 ContentSubresourceFilterDriverFactory* | 70 ContentSubresourceFilterDriverFactory* |
| 69 ContentSubresourceFilterDriverFactory::FromWebContents( | 71 ContentSubresourceFilterDriverFactory::FromWebContents( |
| 70 content::WebContents* web_contents) { | 72 content::WebContents* web_contents) { |
| 71 return static_cast<ContentSubresourceFilterDriverFactory*>( | 73 return static_cast<ContentSubresourceFilterDriverFactory*>( |
| 72 web_contents->GetUserData(kWebContentsUserDataKey)); | 74 web_contents->GetUserData(kWebContentsUserDataKey)); |
| 73 } | 75 } |
| 74 | 76 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 REPORT_REDIRECT_PATTERN_FOR_SUFFIX("SubresourceFilterOnly", hits_pattern, | 330 REPORT_REDIRECT_PATTERN_FOR_SUFFIX("SubresourceFilterOnly", hits_pattern, |
| 329 chain_size); | 331 chain_size); |
| 330 break; | 332 break; |
| 331 default: | 333 default: |
| 332 NOTREACHED(); | 334 NOTREACHED(); |
| 333 break; | 335 break; |
| 334 } | 336 } |
| 335 } | 337 } |
| 336 | 338 |
| 337 } // namespace subresource_filter | 339 } // namespace subresource_filter |
| OLD | NEW |