OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/engine/syncapi.h" | 5 #include "chrome/browser/sync/engine/syncapi.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 using browser_sync::AllStatus; | 47 using browser_sync::AllStatus; |
48 using browser_sync::AllStatusEvent; | 48 using browser_sync::AllStatusEvent; |
49 using browser_sync::AuthWatcher; | 49 using browser_sync::AuthWatcher; |
50 using browser_sync::AuthWatcherEvent; | 50 using browser_sync::AuthWatcherEvent; |
51 using browser_sync::ClientCommandChannel; | 51 using browser_sync::ClientCommandChannel; |
52 using browser_sync::Syncer; | 52 using browser_sync::Syncer; |
53 using browser_sync::SyncerEvent; | 53 using browser_sync::SyncerEvent; |
54 using browser_sync::SyncerStatus; | 54 using browser_sync::SyncerStatus; |
55 using browser_sync::SyncerThread; | 55 using browser_sync::SyncerThread; |
56 using browser_sync::SyncerThreadFactory; | |
57 using browser_sync::UserSettings; | 56 using browser_sync::UserSettings; |
58 using browser_sync::TalkMediator; | 57 using browser_sync::TalkMediator; |
59 using browser_sync::TalkMediatorImpl; | 58 using browser_sync::TalkMediatorImpl; |
60 using std::list; | 59 using std::list; |
61 using std::hex; | 60 using std::hex; |
62 using std::string; | 61 using std::string; |
63 using std::vector; | 62 using std::vector; |
64 using syncable::Directory; | 63 using syncable::Directory; |
65 using syncable::DirectoryManager; | 64 using syncable::DirectoryManager; |
66 | 65 |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 Observer* observer_; | 866 Observer* observer_; |
868 | 867 |
869 // A sink for client commands from the syncer needed to create a SyncerThread. | 868 // A sink for client commands from the syncer needed to create a SyncerThread. |
870 ClientCommandChannel command_channel_; | 869 ClientCommandChannel command_channel_; |
871 | 870 |
872 // The ServerConnectionManager used to abstract communication between the | 871 // The ServerConnectionManager used to abstract communication between the |
873 // client (the Syncer) and the sync server. | 872 // client (the Syncer) and the sync server. |
874 scoped_ptr<SyncAPIServerConnectionManager> connection_manager_; | 873 scoped_ptr<SyncAPIServerConnectionManager> connection_manager_; |
875 | 874 |
876 // The thread that runs the Syncer. Needs to be explicitly Start()ed. | 875 // The thread that runs the Syncer. Needs to be explicitly Start()ed. |
877 scoped_refptr<SyncerThread> syncer_thread_; | 876 scoped_ptr<SyncerThread> syncer_thread_; |
878 | 877 |
879 // Notification (xmpp) handler. | 878 // Notification (xmpp) handler. |
880 scoped_ptr<TalkMediator> talk_mediator_; | 879 scoped_ptr<TalkMediator> talk_mediator_; |
881 | 880 |
882 // A multi-purpose status watch object that aggregates stats from various | 881 // A multi-purpose status watch object that aggregates stats from various |
883 // sync components. | 882 // sync components. |
884 AllStatus allstatus_; | 883 AllStatus allstatus_; |
885 | 884 |
886 // AuthWatcher kicks off the authentication process and follows it through | 885 // AuthWatcher kicks off the authentication process and follows it through |
887 // phase 1 (GAIA) to phase 2 (sync engine). As part of this work it determines | 886 // phase 1 (GAIA) to phase 2 (sync engine). As part of this work it determines |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 talk_mediator()->WatchAuthWatcher(auth_watcher()); | 1056 talk_mediator()->WatchAuthWatcher(auth_watcher()); |
1058 allstatus()->WatchAuthWatcher(auth_watcher()); | 1057 allstatus()->WatchAuthWatcher(auth_watcher()); |
1059 authwatcher_hookup_.reset(NewEventListenerHookup(auth_watcher_->channel(), | 1058 authwatcher_hookup_.reset(NewEventListenerHookup(auth_watcher_->channel(), |
1060 this, &SyncInternal::HandleAuthWatcherEvent)); | 1059 this, &SyncInternal::HandleAuthWatcherEvent)); |
1061 | 1060 |
1062 // Tell the SyncerThread to use the ModelSafeWorker for bookmark model work. | 1061 // Tell the SyncerThread to use the ModelSafeWorker for bookmark model work. |
1063 // We set up both sides of the "bridge" here, with the ModelSafeWorkerBridge | 1062 // We set up both sides of the "bridge" here, with the ModelSafeWorkerBridge |
1064 // on the Syncer side, and |model_safe_worker| on the API client side. | 1063 // on the Syncer side, and |model_safe_worker| on the API client side. |
1065 ModelSafeWorkerBridge* worker = new ModelSafeWorkerBridge(model_safe_worker); | 1064 ModelSafeWorkerBridge* worker = new ModelSafeWorkerBridge(model_safe_worker); |
1066 | 1065 |
1067 syncer_thread_ = SyncerThreadFactory::Create(&command_channel_, | 1066 syncer_thread_.reset(new SyncerThread(&command_channel_, |
1068 dir_manager(), | 1067 dir_manager(), |
1069 connection_manager(), | 1068 connection_manager(), |
1070 &allstatus_, | 1069 &allstatus_, |
1071 worker); | 1070 worker)); |
1072 syncer_thread()->WatchTalkMediator(talk_mediator()); | 1071 syncer_thread()->WatchTalkMediator(talk_mediator()); |
1073 allstatus()->WatchSyncerThread(syncer_thread()); | 1072 allstatus()->WatchSyncerThread(syncer_thread()); |
1074 | 1073 |
1075 syncer_thread()->Start(); // Start the syncer thread. This won't actually | 1074 syncer_thread()->Start(); // Start the syncer thread. This won't actually |
1076 // result in any syncing until at least the | 1075 // result in any syncing until at least the |
1077 // DirectoryManager broadcasts the OPENED event, | 1076 // DirectoryManager broadcasts the OPENED event, |
1078 // and a valid server connection is detected. | 1077 // and a valid server connection is detected. |
1079 | 1078 |
1080 if (attempt_last_user_authentication) | 1079 if (attempt_last_user_authentication) |
1081 AuthenticateForLastKnownUser(); | 1080 AuthenticateForLastKnownUser(); |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 BaseTransaction::~BaseTransaction() { | 1560 BaseTransaction::~BaseTransaction() { |
1562 delete lookup_; | 1561 delete lookup_; |
1563 } | 1562 } |
1564 | 1563 |
1565 UserShare* SyncManager::GetUserShare() const { | 1564 UserShare* SyncManager::GetUserShare() const { |
1566 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; | 1565 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; |
1567 return data_->GetUserShare(); | 1566 return data_->GetUserShare(); |
1568 } | 1567 } |
1569 | 1568 |
1570 } // namespace sync_api | 1569 } // namespace sync_api |
OLD | NEW |