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/sync/glue/session_model_associator.h" | 5 #include "chrome/browser/sync/glue/session_model_associator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 } | 944 } |
945 } | 945 } |
946 | 946 |
947 void SessionModelAssociator::DecrementAndCleanFaviconForURL( | 947 void SessionModelAssociator::DecrementAndCleanFaviconForURL( |
948 const std::string& page_url) { | 948 const std::string& page_url) { |
949 if (page_url.empty()) | 949 if (page_url.empty()) |
950 return; | 950 return; |
951 std::map<std::string, std::string>::const_iterator iter = | 951 std::map<std::string, std::string>::const_iterator iter = |
952 synced_favicon_pages_.find(page_url); | 952 synced_favicon_pages_.find(page_url); |
953 if (iter != synced_favicon_pages_.end()) { | 953 if (iter != synced_favicon_pages_.end()) { |
954 const std::string& favicon_url = iter->second; | 954 const std::string favicon_url = iter->second; |
955 DCHECK_GT(synced_favicons_[favicon_url]->usage_count, 0); | 955 DCHECK_GT(synced_favicons_[favicon_url]->usage_count, 0); |
956 --(synced_favicons_[favicon_url]->usage_count); | 956 --(synced_favicons_[favicon_url]->usage_count); |
957 if (synced_favicons_[favicon_url]->usage_count <= 0) { | 957 if (synced_favicons_[favicon_url]->usage_count <= 0) { |
958 // No more tabs using this favicon. Erase it. | 958 // No more tabs using this favicon. Erase it. |
959 synced_favicons_.erase(favicon_url); | 959 synced_favicons_.erase(favicon_url); |
960 // Erase the page mappings to the favicon url. We iterate through all | 960 // Erase the page mappings to the favicon url. We iterate through all |
961 // page urls in case multiple pages share the same favicon. | 961 // page urls in case multiple pages share the same favicon. |
962 std::map<std::string, std::string>::iterator page_iter; | 962 std::map<std::string, std::string>::iterator page_iter; |
963 for (page_iter = synced_favicon_pages_.begin(); | 963 for (page_iter = synced_favicon_pages_.begin(); |
964 page_iter != synced_favicon_pages_.end();) { | 964 page_iter != synced_favicon_pages_.end();) { |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 bool SessionModelAssociator::CryptoReadyIfNecessary() { | 1452 bool SessionModelAssociator::CryptoReadyIfNecessary() { |
1453 // We only access the cryptographer while holding a transaction. | 1453 // We only access the cryptographer while holding a transaction. |
1454 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 1454 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
1455 const syncable::ModelTypeSet encrypted_types = | 1455 const syncable::ModelTypeSet encrypted_types = |
1456 sync_api::GetEncryptedTypes(&trans); | 1456 sync_api::GetEncryptedTypes(&trans); |
1457 return !encrypted_types.Has(SESSIONS) || | 1457 return !encrypted_types.Has(SESSIONS) || |
1458 sync_service_->IsCryptographerReady(&trans); | 1458 sync_service_->IsCryptographerReady(&trans); |
1459 } | 1459 } |
1460 | 1460 |
1461 } // namespace browser_sync | 1461 } // namespace browser_sync |
OLD | NEW |