| 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/internal_api/sync_manager.h" | 5 #include "chrome/browser/sync/internal_api/sync_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "chrome/browser/sync/js/js_event_handler.h" | 31 #include "chrome/browser/sync/js/js_event_handler.h" |
| 32 #include "chrome/browser/sync/js/js_reply_handler.h" | 32 #include "chrome/browser/sync/js/js_reply_handler.h" |
| 33 #include "chrome/browser/sync/js/js_sync_manager_observer.h" | 33 #include "chrome/browser/sync/js/js_sync_manager_observer.h" |
| 34 #include "chrome/browser/sync/js/js_transaction_observer.h" | 34 #include "chrome/browser/sync/js/js_transaction_observer.h" |
| 35 #include "chrome/browser/sync/notifier/sync_notifier.h" | 35 #include "chrome/browser/sync/notifier/sync_notifier.h" |
| 36 #include "chrome/browser/sync/notifier/sync_notifier_observer.h" | 36 #include "chrome/browser/sync/notifier/sync_notifier_observer.h" |
| 37 #include "chrome/browser/sync/protocol/proto_value_conversions.h" | 37 #include "chrome/browser/sync/protocol/proto_value_conversions.h" |
| 38 #include "chrome/browser/sync/syncable/directory_change_delegate.h" | 38 #include "chrome/browser/sync/syncable/directory_change_delegate.h" |
| 39 #include "chrome/browser/sync/syncable/directory_manager.h" | 39 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 40 #include "chrome/browser/sync/syncable/model_type.h" | 40 #include "chrome/browser/sync/syncable/model_type.h" |
| 41 #include "chrome/browser/sync/syncable/model_type_payload_map.h" |
| 41 #include "chrome/browser/sync/syncable/syncable.h" | 42 #include "chrome/browser/sync/syncable/syncable.h" |
| 42 #include "chrome/browser/sync/util/cryptographer.h" | 43 #include "chrome/browser/sync/util/cryptographer.h" |
| 43 #include "chrome/browser/sync/weak_handle.h" | 44 #include "chrome/browser/sync/weak_handle.h" |
| 44 #include "net/base/network_change_notifier.h" | 45 #include "net/base/network_change_notifier.h" |
| 45 | 46 |
| 46 using std::string; | 47 using std::string; |
| 47 using std::vector; | 48 using std::vector; |
| 48 | 49 |
| 49 using base::TimeDelta; | 50 using base::TimeDelta; |
| 50 using browser_sync::AllStatus; | 51 using browser_sync::AllStatus; |
| (...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1592 | 1593 |
| 1593 // This is here for tests, which are still using p2p notifications. | 1594 // This is here for tests, which are still using p2p notifications. |
| 1594 // | 1595 // |
| 1595 // TODO(chron): Consider changing this back to track has_more_to_sync | 1596 // TODO(chron): Consider changing this back to track has_more_to_sync |
| 1596 // only notify peers if a successful commit has occurred. | 1597 // only notify peers if a successful commit has occurred. |
| 1597 bool is_notifiable_commit = | 1598 bool is_notifiable_commit = |
| 1598 (event.snapshot->syncer_status.num_successful_commits > 0); | 1599 (event.snapshot->syncer_status.num_successful_commits > 0); |
| 1599 if (is_notifiable_commit) { | 1600 if (is_notifiable_commit) { |
| 1600 allstatus_.IncrementNotifiableCommits(); | 1601 allstatus_.IncrementNotifiableCommits(); |
| 1601 if (sync_notifier_.get()) { | 1602 if (sync_notifier_.get()) { |
| 1602 sync_notifier_->SendNotification(); | 1603 const syncable::ModelTypeSet& changed_types = |
| 1604 syncable::ModelTypePayloadMapToSet(event.snapshot->source.types); |
| 1605 sync_notifier_->SendNotification(changed_types); |
| 1603 } else { | 1606 } else { |
| 1604 VLOG(1) << "Not sending notification: sync_notifier_ is NULL"; | 1607 VLOG(1) << "Not sending notification: sync_notifier_ is NULL"; |
| 1605 } | 1608 } |
| 1606 } | 1609 } |
| 1607 } | 1610 } |
| 1608 | 1611 |
| 1609 if (event.what_happened == SyncEngineEvent::STOP_SYNCING_PERMANENTLY) { | 1612 if (event.what_happened == SyncEngineEvent::STOP_SYNCING_PERMANENTLY) { |
| 1610 ObserverList<SyncManager::Observer> temp_obs_list; | 1613 ObserverList<SyncManager::Observer> temp_obs_list; |
| 1611 CopyObservers(&temp_obs_list); | 1614 CopyObservers(&temp_obs_list); |
| 1612 FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, | 1615 FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 | 2058 |
| 2056 for (syncable::ModelTypeSet::const_iterator i = types.begin(); | 2059 for (syncable::ModelTypeSet::const_iterator i = types.begin(); |
| 2057 i != types.end(); ++i) { | 2060 i != types.end(); ++i) { |
| 2058 if (!lookup->initial_sync_ended_for_type(*i)) | 2061 if (!lookup->initial_sync_ended_for_type(*i)) |
| 2059 return false; | 2062 return false; |
| 2060 } | 2063 } |
| 2061 return true; | 2064 return true; |
| 2062 } | 2065 } |
| 2063 | 2066 |
| 2064 } // namespace sync_api | 2067 } // namespace sync_api |
| OLD | NEW |