| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/tracked.h" | 11 #include "base/tracked.h" |
| 12 #include "chrome/browser/extensions/extension_tab_helper.h" | 12 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/sessions/restore_tab_helper.h" | 14 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 15 #include "chrome/browser/sessions/session_service_factory.h" | 15 #include "chrome/browser/sessions/session_service_factory.h" |
| 16 #include "chrome/browser/sync/profile_sync_service.h" | 16 #include "chrome/browser/sync/profile_sync_service.h" |
| 17 #include "chrome/browser/sync/syncable/syncable.h" | 17 #include "chrome/browser/sync/syncable/syncable.h" |
| 18 #include "chrome/browser/tabs/tab_strip_model.h" | 18 #include "chrome/browser/tabs/tab_strip_model.h" |
| 19 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
| 20 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
| 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 22 #include "chrome/common/chrome_notification_types.h" |
| 22 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
| 23 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 24 #include "content/browser/tab_contents/navigation_controller.h" | 25 #include "content/browser/tab_contents/navigation_controller.h" |
| 25 #include "content/browser/tab_contents/navigation_entry.h" | 26 #include "content/browser/tab_contents/navigation_entry.h" |
| 26 #include "content/common/notification_details.h" | 27 #include "content/common/notification_details.h" |
| 27 #include "content/common/notification_service.h" | 28 #include "content/common/notification_service.h" |
| 28 | 29 |
| 29 namespace browser_sync { | 30 namespace browser_sync { |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 bool SessionModelAssociator::DisassociateModels() { | 420 bool SessionModelAssociator::DisassociateModels() { |
| 420 DCHECK(CalledOnValidThread()); | 421 DCHECK(CalledOnValidThread()); |
| 421 synced_session_tracker_.clear(); | 422 synced_session_tracker_.clear(); |
| 422 tab_map_.clear(); | 423 tab_map_.clear(); |
| 423 tab_pool_.clear(); | 424 tab_pool_.clear(); |
| 424 local_session_syncid_ = sync_api::kInvalidId; | 425 local_session_syncid_ = sync_api::kInvalidId; |
| 425 | 426 |
| 426 // There is no local model stored with which to disassociate, just notify | 427 // There is no local model stored with which to disassociate, just notify |
| 427 // foreign session handlers. | 428 // foreign session handlers. |
| 428 NotificationService::current()->Notify( | 429 NotificationService::current()->Notify( |
| 429 NotificationType::FOREIGN_SESSION_DISABLED, | 430 chrome::NOTIFICATION_FOREIGN_SESSION_DISABLED, |
| 430 NotificationService::AllSources(), | 431 NotificationService::AllSources(), |
| 431 NotificationService::NoDetails()); | 432 NotificationService::NoDetails()); |
| 432 return true; | 433 return true; |
| 433 } | 434 } |
| 434 | 435 |
| 435 void SessionModelAssociator::InitializeCurrentMachineTag( | 436 void SessionModelAssociator::InitializeCurrentMachineTag( |
| 436 sync_api::WriteTransaction* trans) { | 437 sync_api::WriteTransaction* trans) { |
| 437 DCHECK(CalledOnValidThread()); | 438 DCHECK(CalledOnValidThread()); |
| 438 syncable::Directory* dir = trans->GetWrappedWriteTrans()->directory(); | 439 syncable::Directory* dir = trans->GetWrappedWriteTrans()->directory(); |
| 439 | 440 |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 bool SessionModelAssociator::CryptoReadyIfNecessary() { | 985 bool SessionModelAssociator::CryptoReadyIfNecessary() { |
| 985 // We only access the cryptographer while holding a transaction. | 986 // We only access the cryptographer while holding a transaction. |
| 986 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 987 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
| 987 syncable::ModelTypeSet encrypted_types; | 988 syncable::ModelTypeSet encrypted_types; |
| 988 encrypted_types = sync_api::GetEncryptedTypes(&trans); | 989 encrypted_types = sync_api::GetEncryptedTypes(&trans); |
| 989 return encrypted_types.count(syncable::SESSIONS) == 0 || | 990 return encrypted_types.count(syncable::SESSIONS) == 0 || |
| 990 sync_service_->IsCryptographerReady(&trans); | 991 sync_service_->IsCryptographerReady(&trans); |
| 991 } | 992 } |
| 992 | 993 |
| 993 } // namespace browser_sync | 994 } // namespace browser_sync |
| OLD | NEW |