OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/syncer_command.h" | 5 #include "chrome/browser/sync/engine/syncer_command.h" |
6 | 6 |
7 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 7 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
8 #include "chrome/browser/sync/sessions/sync_session.h" | 8 #include "chrome/browser/sync/sessions/sync_session.h" |
9 #include "chrome/browser/sync/syncable/directory_manager.h" | 9 #include "chrome/browser/sync/syncable/directory_manager.h" |
10 #include "chrome/common/deprecated/event_sys-inl.h" | |
11 | 10 |
12 namespace browser_sync { | 11 namespace browser_sync { |
13 using sessions::SyncSession; | 12 using sessions::SyncSession; |
14 | 13 |
15 SyncerCommand::SyncerCommand() {} | 14 SyncerCommand::SyncerCommand() {} |
16 SyncerCommand::~SyncerCommand() {} | 15 SyncerCommand::~SyncerCommand() {} |
17 | 16 |
18 void SyncerCommand::Execute(SyncSession* session) { | 17 void SyncerCommand::Execute(SyncSession* session) { |
19 ExecuteImpl(session); | 18 ExecuteImpl(session); |
20 SendNotifications(session); | 19 SendNotifications(session); |
21 } | 20 } |
22 | 21 |
23 void SyncerCommand::SendNotifications(SyncSession* session) { | 22 void SyncerCommand::SendNotifications(SyncSession* session) { |
24 syncable::ScopedDirLookup dir(session->context()->directory_manager(), | 23 syncable::ScopedDirLookup dir(session->context()->directory_manager(), |
25 session->context()->account_name()); | 24 session->context()->account_name()); |
26 if (!dir.good()) { | 25 if (!dir.good()) { |
27 LOG(ERROR) << "Scoped dir lookup failed!"; | 26 LOG(ERROR) << "Scoped dir lookup failed!"; |
28 return; | 27 return; |
29 } | 28 } |
30 | 29 |
31 if (session->status_controller()->TestAndClearIsDirty()) { | 30 if (session->status_controller()->TestAndClearIsDirty()) { |
32 SyncEngineEvent event(SyncEngineEvent::STATUS_CHANGED); | 31 SyncEngineEvent event(SyncEngineEvent::STATUS_CHANGED); |
33 const sessions::SyncSessionSnapshot& snapshot(session->TakeSnapshot()); | 32 const sessions::SyncSessionSnapshot& snapshot(session->TakeSnapshot()); |
34 event.snapshot = &snapshot; | 33 event.snapshot = &snapshot; |
35 session->context()->NotifyListeners(event); | 34 session->context()->NotifyListeners(event); |
36 } | 35 } |
37 } | 36 } |
38 | 37 |
39 } // namespace browser_sync | 38 } // namespace browser_sync |
OLD | NEW |