| OLD | NEW |
| 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/common/content_settings_pattern.h" | 5 #include "chrome/common/content_settings_pattern.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 : parts_(parts), | 396 : parts_(parts), |
| 397 is_valid_(valid) { | 397 is_valid_(valid) { |
| 398 } | 398 } |
| 399 | 399 |
| 400 void ContentSettingsPattern::WriteToMessage(IPC::Message* m) const { | 400 void ContentSettingsPattern::WriteToMessage(IPC::Message* m) const { |
| 401 IPC::WriteParam(m, is_valid_); | 401 IPC::WriteParam(m, is_valid_); |
| 402 IPC::WriteParam(m, parts_); | 402 IPC::WriteParam(m, parts_); |
| 403 } | 403 } |
| 404 | 404 |
| 405 bool ContentSettingsPattern::ReadFromMessage(const IPC::Message* m, | 405 bool ContentSettingsPattern::ReadFromMessage(const IPC::Message* m, |
| 406 void** iter) { | 406 PickleIterator* iter) { |
| 407 return IPC::ReadParam(m, iter, &is_valid_) && | 407 return IPC::ReadParam(m, iter, &is_valid_) && |
| 408 IPC::ReadParam(m, iter, &parts_); | 408 IPC::ReadParam(m, iter, &parts_); |
| 409 } | 409 } |
| 410 | 410 |
| 411 bool ContentSettingsPattern::Matches( | 411 bool ContentSettingsPattern::Matches( |
| 412 const GURL& url) const { | 412 const GURL& url) const { |
| 413 // An invalid pattern matches nothing. | 413 // An invalid pattern matches nothing. |
| 414 if (!is_valid_) | 414 if (!is_valid_) |
| 415 return false; | 415 return false; |
| 416 | 416 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 if (!parts.is_port_wildcard && other_parts.is_port_wildcard) | 635 if (!parts.is_port_wildcard && other_parts.is_port_wildcard) |
| 636 return ContentSettingsPattern::PREDECESSOR; | 636 return ContentSettingsPattern::PREDECESSOR; |
| 637 | 637 |
| 638 int result = parts.port.compare(other_parts.port); | 638 int result = parts.port.compare(other_parts.port); |
| 639 if (result == 0) | 639 if (result == 0) |
| 640 return ContentSettingsPattern::IDENTITY; | 640 return ContentSettingsPattern::IDENTITY; |
| 641 if (result > 0) | 641 if (result > 0) |
| 642 return ContentSettingsPattern::DISJOINT_ORDER_PRE; | 642 return ContentSettingsPattern::DISJOINT_ORDER_PRE; |
| 643 return ContentSettingsPattern::DISJOINT_ORDER_POST; | 643 return ContentSettingsPattern::DISJOINT_ORDER_POST; |
| 644 } | 644 } |
| OLD | NEW |