OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 CHECK(has_nodes); | 94 CHECK(has_nodes); |
95 *has_nodes = false; | 95 *has_nodes = false; |
96 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 96 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
97 sync_api::ReadNode root(&trans); | 97 sync_api::ReadNode root(&trans); |
98 if (!root.InitByTagLookup(kSessionsTag)) { | 98 if (!root.InitByTagLookup(kSessionsTag)) { |
99 LOG(ERROR) << kNoSessionsFolderError; | 99 LOG(ERROR) << kNoSessionsFolderError; |
100 return false; | 100 return false; |
101 } | 101 } |
102 // The sync model has user created nodes iff the sessions folder has | 102 // The sync model has user created nodes iff the sessions folder has |
103 // any children. | 103 // any children. |
104 *has_nodes = root.GetFirstChildId() != sync_api::kInvalidId; | 104 *has_nodes = root.HasChildren(); |
105 return true; | 105 return true; |
106 } | 106 } |
107 | 107 |
108 int64 SessionModelAssociator::GetSyncIdFromChromeId(const size_t& id) { | 108 int64 SessionModelAssociator::GetSyncIdFromChromeId(const size_t& id) { |
109 DCHECK(CalledOnValidThread()); | 109 DCHECK(CalledOnValidThread()); |
110 return GetSyncIdFromSessionTag(TabIdToTag(GetCurrentMachineTag(), id)); | 110 return GetSyncIdFromSessionTag(TabIdToTag(GetCurrentMachineTag(), id)); |
111 } | 111 } |
112 | 112 |
113 int64 SessionModelAssociator::GetSyncIdFromSessionTag(const std::string& tag) { | 113 int64 SessionModelAssociator::GetSyncIdFromSessionTag(const std::string& tag) { |
114 DCHECK(CalledOnValidThread()); | 114 DCHECK(CalledOnValidThread()); |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 char computer_name[MAX_COMPUTERNAME_LENGTH + 1]; | 1284 char computer_name[MAX_COMPUTERNAME_LENGTH + 1]; |
1285 DWORD size = sizeof(computer_name); | 1285 DWORD size = sizeof(computer_name); |
1286 if (GetComputerNameA(computer_name, &size)) { | 1286 if (GetComputerNameA(computer_name, &size)) { |
1287 return computer_name; | 1287 return computer_name; |
1288 } | 1288 } |
1289 return std::string(); | 1289 return std::string(); |
1290 } | 1290 } |
1291 #endif | 1291 #endif |
1292 | 1292 |
1293 } // namespace browser_sync | 1293 } // namespace browser_sync |
OLD | NEW |