| 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/browser/browsing_data/cookies_tree_model.h" | 5 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // string comparison works to order hosts by registry controlled domain | 69 // string comparison works to order hosts by registry controlled domain |
| 70 // first. Leading dots are ignored, ".google.com" is the same as | 70 // first. Leading dots are ignored, ".google.com" is the same as |
| 71 // "google.com". | 71 // "google.com". |
| 72 | 72 |
| 73 if (url.SchemeIsFile()) { | 73 if (url.SchemeIsFile()) { |
| 74 return std::string(chrome::kFileScheme) + | 74 return std::string(chrome::kFileScheme) + |
| 75 content::kStandardSchemeSeparator; | 75 content::kStandardSchemeSeparator; |
| 76 } | 76 } |
| 77 | 77 |
| 78 std::string host = url.host(); | 78 std::string host = url.host(); |
| 79 std::string retval = net::RegistryControlledDomainService:: | 79 std::string retval = |
| 80 GetDomainAndRegistry(host); | 80 net::registry_controlled_domains::GetDomainAndRegistry( |
| 81 host, |
| 82 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
| 81 if (!retval.length()) // Is an IP address or other special origin. | 83 if (!retval.length()) // Is an IP address or other special origin. |
| 82 return host; | 84 return host; |
| 83 | 85 |
| 84 std::string::size_type position = host.rfind(retval); | 86 std::string::size_type position = host.rfind(retval); |
| 85 | 87 |
| 86 // The host may be the registry controlled domain, in which case fail fast. | 88 // The host may be the registry controlled domain, in which case fail fast. |
| 87 if (position == 0 || position == std::string::npos) | 89 if (position == 0 || position == std::string::npos) |
| 88 return host; | 90 return host; |
| 89 | 91 |
| 90 // If host is www.google.com, retval will contain google.com at this point. | 92 // If host is www.google.com, retval will contain google.com at this point. |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 | 1328 |
| 1327 void CookiesTreeModel::NotifyObserverEndBatch() { | 1329 void CookiesTreeModel::NotifyObserverEndBatch() { |
| 1328 // Only notify the observers if this is the outermost call to EndBatch() if | 1330 // Only notify the observers if this is the outermost call to EndBatch() if |
| 1329 // called in a nested manner. | 1331 // called in a nested manner. |
| 1330 if (--batch_update_ == 0) { | 1332 if (--batch_update_ == 0) { |
| 1331 FOR_EACH_OBSERVER(Observer, | 1333 FOR_EACH_OBSERVER(Observer, |
| 1332 cookies_observer_list_, | 1334 cookies_observer_list_, |
| 1333 TreeModelEndBatch(this)); | 1335 TreeModelEndBatch(this)); |
| 1334 } | 1336 } |
| 1335 } | 1337 } |
| OLD | NEW |