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 "chrome/browser/extensions/extension_tab_helper.h" | 11 #include "chrome/browser/extensions/extension_tab_helper.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/sessions/session_service_factory.h" |
13 #include "chrome/browser/sync/profile_sync_service.h" | 14 #include "chrome/browser/sync/profile_sync_service.h" |
14 #include "chrome/browser/sync/syncable/syncable.h" | 15 #include "chrome/browser/sync/syncable/syncable.h" |
15 #include "chrome/browser/tabs/tab_strip_model.h" | 16 #include "chrome/browser/tabs/tab_strip_model.h" |
16 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
17 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
19 #include "chrome/common/extensions/extension.h" | 20 #include "chrome/common/extensions/extension.h" |
20 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
21 #include "content/browser/tab_contents/navigation_controller.h" | 22 #include "content/browser/tab_contents/navigation_controller.h" |
22 #include "content/browser/tab_contents/navigation_entry.h" | 23 #include "content/browser/tab_contents/navigation_entry.h" |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 | 845 |
845 // ========================================================================== | 846 // ========================================================================== |
846 // The following methods are not currently used but will likely become useful | 847 // The following methods are not currently used but will likely become useful |
847 // if we choose to sync the previous browser session. | 848 // if we choose to sync the previous browser session. |
848 | 849 |
849 SessionService* SessionModelAssociator::GetSessionService() { | 850 SessionService* SessionModelAssociator::GetSessionService() { |
850 DCHECK(CalledOnValidThread()); | 851 DCHECK(CalledOnValidThread()); |
851 DCHECK(sync_service_); | 852 DCHECK(sync_service_); |
852 Profile* profile = sync_service_->profile(); | 853 Profile* profile = sync_service_->profile(); |
853 DCHECK(profile); | 854 DCHECK(profile); |
854 SessionService* sessions_service = profile->GetSessionService(); | 855 SessionService* sessions_service = |
| 856 SessionServiceFactory::GetForProfile(profile); |
855 DCHECK(sessions_service); | 857 DCHECK(sessions_service); |
856 return sessions_service; | 858 return sessions_service; |
857 } | 859 } |
858 | 860 |
859 void SessionModelAssociator::OnGotSession( | 861 void SessionModelAssociator::OnGotSession( |
860 int handle, | 862 int handle, |
861 std::vector<SessionWindow*>* windows) { | 863 std::vector<SessionWindow*>* windows) { |
862 DCHECK(CalledOnValidThread()); | 864 DCHECK(CalledOnValidThread()); |
863 DCHECK(local_session_syncid_); | 865 DCHECK(local_session_syncid_); |
864 | 866 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 bool SessionModelAssociator::CryptoReadyIfNecessary() { | 997 bool SessionModelAssociator::CryptoReadyIfNecessary() { |
996 // We only access the cryptographer while holding a transaction. | 998 // We only access the cryptographer while holding a transaction. |
997 sync_api::ReadTransaction trans(sync_service_->GetUserShare()); | 999 sync_api::ReadTransaction trans(sync_service_->GetUserShare()); |
998 syncable::ModelTypeSet encrypted_types; | 1000 syncable::ModelTypeSet encrypted_types; |
999 sync_service_->GetEncryptedDataTypes(&encrypted_types); | 1001 sync_service_->GetEncryptedDataTypes(&encrypted_types); |
1000 return encrypted_types.count(syncable::SESSIONS) == 0 || | 1002 return encrypted_types.count(syncable::SESSIONS) == 0 || |
1001 sync_service_->IsCryptographerReady(&trans); | 1003 sync_service_->IsCryptographerReady(&trans); |
1002 } | 1004 } |
1003 | 1005 |
1004 } // namespace browser_sync | 1006 } // namespace browser_sync |
OLD | NEW |