Vectorize website settings icons in omnibox
[chromium-blink-merge.git] / components / sync_driver / glue / synced_session.cc
blob40cc7e5489c55248d710e78a925840475fcba7da
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
3 // found in the LICENSE file.
5 #include "components/sync_driver/glue/synced_session.h"
7 #include "base/stl_util.h"
9 namespace sync_driver {
11 SyncedSession::SyncedSession()
12 : session_tag("invalid"), device_type(TYPE_UNSET) {
15 SyncedSession::~SyncedSession() {
16 STLDeleteContainerPairSecondPointers(windows.begin(), windows.end());
19 sync_pb::SessionHeader SyncedSession::ToSessionHeader() const {
20 sync_pb::SessionHeader header;
21 SyncedWindowMap::const_iterator iter;
22 for (iter = windows.begin(); iter != windows.end(); ++iter) {
23 sync_pb::SessionWindow* w = header.add_window();
24 w->CopyFrom(iter->second->ToSyncData());
26 header.set_client_name(session_name);
27 switch (device_type) {
28 case SyncedSession::TYPE_WIN:
29 header.set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_WIN);
30 break;
31 case SyncedSession::TYPE_MACOSX:
32 header.set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_MAC);
33 break;
34 case SyncedSession::TYPE_LINUX:
35 header.set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_LINUX);
36 break;
37 case SyncedSession::TYPE_CHROMEOS:
38 header.set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_CROS);
39 break;
40 case SyncedSession::TYPE_PHONE:
41 header.set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_PHONE);
42 break;
43 case SyncedSession::TYPE_TABLET:
44 header.set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_TABLET);
45 break;
46 case SyncedSession::TYPE_OTHER:
47 // Intentionally fall-through
48 default:
49 header.set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_OTHER);
50 break;
52 return header;
55 } // namespace sync_driver