| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_HOST_PATTERN_H_ |
| 6 #define CHROME_BROWSER_CONTENT_SETTINGS_HOST_PATTERN_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "chrome/browser/content_settings/content_settings_pattern.h" |
| 10 #include "chrome/browser/content_settings/host.h" |
| 11 |
| 12 namespace content_settings { |
| 13 |
| 14 class HostPattern { |
| 15 public: |
| 16 HostPattern(const ContentSettingsPattern& requesting_url_pattern, |
| 17 const ContentSettingsPattern& embedding_url_pattern) : |
| 18 requesting_url_pattern_(requesting_url_pattern), |
| 19 embedding_url_pattern_(embedding_url_pattern) {} |
| 20 |
| 21 // Return true if the HostPattern matches the given |source|. |
| 22 bool Matches(const Host& host) const { |
| 23 return requesting_url_pattern_.Matches(host.requesting_url()) && |
| 24 embedding_url_pattern_.Matches(host.embedding_url()); |
| 25 } |
| 26 |
| 27 const ContentSettingsPattern& requesting_url_pattern() { |
| 28 return requesting_url_pattern_; |
| 29 } |
| 30 |
| 31 const ContentSettingsPattern& embedding_url_pattern() { |
| 32 return embedding_url_pattern_; |
| 33 } |
| 34 |
| 35 private: |
| 36 const ContentSettingsPattern requesting_url_pattern_; |
| 37 const ContentSettingsPattern embedding_url_pattern_; |
| 38 }; |
| 39 |
| 40 } // namespace content_Settings |
| 41 |
| 42 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_PATTERN_H_ |
| OLD | NEW |