Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(860)

Side by Side Diff: chrome/browser/sync/engine/syncapi.cc

Issue 6526059: Plumb through NetworkChangeNotifier::IsOffline() to WebKit, enabling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Appease the C++ type system Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <algorithm> 7 #include <algorithm>
8 #include <bitset> 8 #include <bitset>
9 #include <iomanip> 9 #include <iomanip>
10 #include <list> 10 #include <list>
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 } 1100 }
1101 1101
1102 const sync_pb::PasswordSpecificsData& 1102 const sync_pb::PasswordSpecificsData&
1103 SyncManager::ExtraPasswordChangeRecordData::unencrypted() const { 1103 SyncManager::ExtraPasswordChangeRecordData::unencrypted() const {
1104 return unencrypted_; 1104 return unencrypted_;
1105 } 1105 }
1106 1106
1107 ////////////////////////////////////////////////////////////////////////// 1107 //////////////////////////////////////////////////////////////////////////
1108 // SyncManager's implementation: SyncManager::SyncInternal 1108 // SyncManager's implementation: SyncManager::SyncInternal
1109 class SyncManager::SyncInternal 1109 class SyncManager::SyncInternal
1110 : public net::NetworkChangeNotifier::Observer, 1110 : public net::NetworkChangeNotifier::IPAddressObserver,
1111 public TalkMediator::Delegate, 1111 public TalkMediator::Delegate,
1112 public sync_notifier::StateWriter, 1112 public sync_notifier::StateWriter,
1113 public browser_sync::ChannelEventHandler<syncable::DirectoryChangeEvent>, 1113 public browser_sync::ChannelEventHandler<syncable::DirectoryChangeEvent>,
1114 public browser_sync::JsBackend, 1114 public browser_sync::JsBackend,
1115 public SyncEngineEventListener { 1115 public SyncEngineEventListener {
1116 static const int kDefaultNudgeDelayMilliseconds; 1116 static const int kDefaultNudgeDelayMilliseconds;
1117 static const int kPreferencesNudgeDelayMilliseconds; 1117 static const int kPreferencesNudgeDelayMilliseconds;
1118 public: 1118 public:
1119 explicit SyncInternal(SyncManager* sync_manager) 1119 explicit SyncInternal(SyncManager* sync_manager)
1120 : core_message_loop_(NULL), 1120 : core_message_loop_(NULL),
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 1660
1661 share_.dir_manager.reset(new DirectoryManager(database_location)); 1661 share_.dir_manager.reset(new DirectoryManager(database_location));
1662 1662
1663 connection_manager_.reset(new SyncAPIServerConnectionManager( 1663 connection_manager_.reset(new SyncAPIServerConnectionManager(
1664 sync_server_and_path, port, use_ssl, user_agent, post_factory)); 1664 sync_server_and_path, port, use_ssl, user_agent, post_factory));
1665 1665
1666 connection_manager_hookup_.reset( 1666 connection_manager_hookup_.reset(
1667 NewEventListenerHookup(connection_manager()->channel(), this, 1667 NewEventListenerHookup(connection_manager()->channel(), this,
1668 &SyncManager::SyncInternal::HandleServerConnectionEvent)); 1668 &SyncManager::SyncInternal::HandleServerConnectionEvent));
1669 1669
1670 net::NetworkChangeNotifier::AddObserver(this); 1670 net::NetworkChangeNotifier::AddIPAddressObserver(this);
1671 // TODO(akalin): CheckServerReachable() can block, which may cause jank if we 1671 // TODO(akalin): CheckServerReachable() can block, which may cause jank if we
1672 // try to shut down sync. Fix this. 1672 // try to shut down sync. Fix this.
1673 core_message_loop_->PostTask(FROM_HERE, 1673 core_message_loop_->PostTask(FROM_HERE,
1674 method_factory_.NewRunnableMethod(&SyncInternal::CheckServerReachable)); 1674 method_factory_.NewRunnableMethod(&SyncInternal::CheckServerReachable));
1675 1675
1676 // Test mode does not use a syncer context or syncer thread. 1676 // Test mode does not use a syncer context or syncer thread.
1677 if (!setup_for_test_mode_) { 1677 if (!setup_for_test_mode_) {
1678 // Build a SyncSessionContext and store the worker in it. 1678 // Build a SyncSessionContext and store the worker in it.
1679 VLOG(1) << "Sync is bringing up SyncSessionContext."; 1679 VLOG(1) << "Sync is bringing up SyncSessionContext.";
1680 std::vector<SyncEngineEventListener*> listeners; 1680 std::vector<SyncEngineEventListener*> listeners;
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 // and HandleTalkMediatorEvent() for the 2152 // and HandleTalkMediatorEvent() for the
2153 // events that may be posted.) 2153 // events that may be posted.)
2154 { 2154 {
2155 CHECK(core_message_loop_); 2155 CHECK(core_message_loop_);
2156 bool old_state = core_message_loop_->NestableTasksAllowed(); 2156 bool old_state = core_message_loop_->NestableTasksAllowed();
2157 core_message_loop_->SetNestableTasksAllowed(true); 2157 core_message_loop_->SetNestableTasksAllowed(true);
2158 core_message_loop_->RunAllPending(); 2158 core_message_loop_->RunAllPending();
2159 core_message_loop_->SetNestableTasksAllowed(old_state); 2159 core_message_loop_->SetNestableTasksAllowed(old_state);
2160 } 2160 }
2161 2161
2162 net::NetworkChangeNotifier::RemoveObserver(this); 2162 net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
2163 2163
2164 connection_manager_hookup_.reset(); 2164 connection_manager_hookup_.reset();
2165 2165
2166 if (dir_manager()) { 2166 if (dir_manager()) {
2167 dir_manager()->FinalSaveChangesForAll(); 2167 dir_manager()->FinalSaveChangesForAll();
2168 dir_manager()->Close(username_for_share()); 2168 dir_manager()->Close(username_for_share());
2169 } 2169 }
2170 2170
2171 // Reset the DirectoryManager and UserSettings so they relinquish sqlite 2171 // Reset the DirectoryManager and UserSettings so they relinquish sqlite
2172 // handles to backing files. 2172 // handles to backing files.
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
2822 2822
2823 void SyncManager::TriggerOnIncomingNotificationForTest( 2823 void SyncManager::TriggerOnIncomingNotificationForTest(
2824 const syncable::ModelTypeBitSet& model_types) { 2824 const syncable::ModelTypeBitSet& model_types) {
2825 IncomingNotificationData notification_data; 2825 IncomingNotificationData notification_data;
2826 notification_data.service_url = model_types.to_string(); 2826 notification_data.service_url = model_types.to_string();
2827 // Here we rely on the default notification method being SERVER. 2827 // Here we rely on the default notification method being SERVER.
2828 data_->OnIncomingNotification(notification_data); 2828 data_->OnIncomingNotification(notification_data);
2829 } 2829 }
2830 2830
2831 } // namespace sync_api 2831 } // namespace sync_api
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698