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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 "Server did not create the top-level sessions node. We " | 61 "Server did not create the top-level sessions node. We " |
62 "might be running against an out-of-date server."; | 62 "might be running against an out-of-date server."; |
63 | 63 |
64 // The maximum number of navigations in each direction we care to sync. | 64 // The maximum number of navigations in each direction we care to sync. |
65 static const int kMaxSyncNavigationCount = 6; | 65 static const int kMaxSyncNavigationCount = 6; |
66 | 66 |
67 // Default number of days without activity after which a session is considered | 67 // Default number of days without activity after which a session is considered |
68 // stale and becomes a candidate for garbage collection. | 68 // stale and becomes a candidate for garbage collection. |
69 static const size_t kDefaultStaleSessionThresholdDays = 14; // 2 weeks. | 69 static const size_t kDefaultStaleSessionThresholdDays = 14; // 2 weeks. |
70 | 70 |
71 #if defined(OS_ANDROID) | |
72 bool IsTabletUi() { | |
sky
2012/07/20 16:58:09
I've never seen Ui capitalized like this -> UI
benm (inactive)
2012/07/23 09:17:04
Done.
| |
73 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUi); | |
74 } | |
75 #endif | |
76 | |
71 sync_pb::SessionHeader::DeviceType GetLocalDeviceType() { | 77 sync_pb::SessionHeader::DeviceType GetLocalDeviceType() { |
72 // TODO(yfriedman): Refactor/combine with "DeviceInformation" code in | 78 // TODO(yfriedman): Refactor/combine with "DeviceInformation" code in |
73 // sync_manager.cc[1060] | 79 // sync_manager.cc[1060] |
74 #if defined(OS_CHROMEOS) | 80 #if defined(OS_CHROMEOS) |
75 return sync_pb::SessionHeader_DeviceType_TYPE_CROS; | 81 return sync_pb::SessionHeader_DeviceType_TYPE_CROS; |
76 #elif defined(OS_LINUX) | 82 #elif defined(OS_LINUX) |
77 return sync_pb::SessionHeader_DeviceType_TYPE_LINUX; | 83 return sync_pb::SessionHeader_DeviceType_TYPE_LINUX; |
78 #elif defined(OS_MACOSX) | 84 #elif defined(OS_MACOSX) |
79 return sync_pb::SessionHeader_DeviceType_TYPE_MAC; | 85 return sync_pb::SessionHeader_DeviceType_TYPE_MAC; |
80 #elif defined(OS_WIN) | 86 #elif defined(OS_WIN) |
81 return sync_pb::SessionHeader_DeviceType_TYPE_WIN; | 87 return sync_pb::SessionHeader_DeviceType_TYPE_WIN; |
82 #elif defined(OS_ANDROID) | 88 #elif defined(OS_ANDROID) |
83 return syncer::internal::IsTabletUi() ? | 89 return IsTabletUi() ? |
84 sync_pb::SessionHeader_DeviceType_TYPE_TABLET : | 90 sync_pb::SessionHeader_DeviceType_TYPE_TABLET : |
85 sync_pb::SessionHeader_DeviceType_TYPE_PHONE; | 91 sync_pb::SessionHeader_DeviceType_TYPE_PHONE; |
86 #else | 92 #else |
87 return sync_pb::SessionHeader_DeviceType_TYPE_OTHER; | 93 return sync_pb::SessionHeader_DeviceType_TYPE_OTHER; |
88 #endif | 94 #endif |
89 } | 95 } |
90 | 96 |
91 } // namespace | 97 } // namespace |
92 | 98 |
93 SessionModelAssociator::SessionModelAssociator(ProfileSyncService* sync_service, | 99 SessionModelAssociator::SessionModelAssociator(ProfileSyncService* sync_service, |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1590 bool SessionModelAssociator::CryptoReadyIfNecessary() { | 1596 bool SessionModelAssociator::CryptoReadyIfNecessary() { |
1591 // We only access the cryptographer while holding a transaction. | 1597 // We only access the cryptographer while holding a transaction. |
1592 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 1598 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
1593 const syncer::ModelTypeSet encrypted_types = | 1599 const syncer::ModelTypeSet encrypted_types = |
1594 syncer::GetEncryptedTypes(&trans); | 1600 syncer::GetEncryptedTypes(&trans); |
1595 return !encrypted_types.Has(SESSIONS) || | 1601 return !encrypted_types.Has(SESSIONS) || |
1596 sync_service_->IsCryptographerReady(&trans); | 1602 sync_service_->IsCryptographerReady(&trans); |
1597 } | 1603 } |
1598 | 1604 |
1599 } // namespace browser_sync | 1605 } // namespace browser_sync |
OLD | NEW |