| 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 "components/sync_sessions/synced_session.h" | 5 #include "components/sync_sessions/synced_session.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 | 8 |
| 9 namespace sync_driver { | 9 namespace sync_driver { |
| 10 | 10 |
| 11 SyncedSession::SyncedSession() | 11 SyncedSession::SyncedSession() |
| 12 : session_tag("invalid"), device_type(TYPE_UNSET) {} | 12 : session_tag("invalid"), device_type(TYPE_UNSET) {} |
| 13 | 13 |
| 14 SyncedSession::~SyncedSession() { | 14 SyncedSession::~SyncedSession() { |
| 15 STLDeleteContainerPairSecondPointers(windows.begin(), windows.end()); | 15 base::STLDeleteContainerPairSecondPointers(windows.begin(), windows.end()); |
| 16 } | 16 } |
| 17 | 17 |
| 18 sync_pb::SessionHeader SyncedSession::ToSessionHeader() const { | 18 sync_pb::SessionHeader SyncedSession::ToSessionHeader() const { |
| 19 sync_pb::SessionHeader header; | 19 sync_pb::SessionHeader header; |
| 20 SyncedWindowMap::const_iterator iter; | 20 SyncedWindowMap::const_iterator iter; |
| 21 for (iter = windows.begin(); iter != windows.end(); ++iter) { | 21 for (iter = windows.begin(); iter != windows.end(); ++iter) { |
| 22 sync_pb::SessionWindow* w = header.add_window(); | 22 sync_pb::SessionWindow* w = header.add_window(); |
| 23 w->CopyFrom(iter->second->ToSyncData()); | 23 w->CopyFrom(iter->second->ToSyncData()); |
| 24 } | 24 } |
| 25 header.set_client_name(session_name); | 25 header.set_client_name(session_name); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 45 case SyncedSession::TYPE_OTHER: | 45 case SyncedSession::TYPE_OTHER: |
| 46 // Intentionally fall-through | 46 // Intentionally fall-through |
| 47 default: | 47 default: |
| 48 header.set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_OTHER); | 48 header.set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_OTHER); |
| 49 break; | 49 break; |
| 50 } | 50 } |
| 51 return header; | 51 return header; |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace sync_driver | 54 } // namespace sync_driver |
| OLD | NEW |