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

Unified Diff: chrome/browser/sync/engine/net/server_connection_manager.cc

Issue 6690020: sync: hook up ServerConnectionManager <> SyncerThread2 and tie up more loose ends (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/debug
Patch Set: fix 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/engine/net/server_connection_manager.h ('k') | chrome/browser/sync/engine/syncapi.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/net/server_connection_manager.cc
diff --git a/chrome/browser/sync/engine/net/server_connection_manager.cc b/chrome/browser/sync/engine/net/server_connection_manager.cc
index 7f53a29dd8a23564ff4803d22f8d936bdf2e73a7..4598588729386e3ee2b5c2766387cf6c7864c37d 100644
--- a/chrome/browser/sync/engine/net/server_connection_manager.cc
+++ b/chrome/browser/sync/engine/net/server_connection_manager.cc
@@ -10,6 +10,7 @@
#include <string>
#include <vector>
+#include "base/command_line.h"
#include "build/build_config.h"
#include "chrome/browser/sync/engine/net/url_translator.h"
#include "chrome/browser/sync/engine/syncapi.h"
@@ -17,6 +18,7 @@
#include "chrome/browser/sync/engine/syncproto.h"
#include "chrome/browser/sync/protocol/sync.pb.h"
#include "chrome/browser/sync/syncable/directory_manager.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/net/http_return.h"
#include "googleurl/src/gurl.h"
@@ -144,6 +146,7 @@ ServerConnectionManager::ServerConnectionManager(
get_time_path_(kSyncServerGetTimePath),
error_count_(0),
channel_(new Channel(shutdown_event)),
+ listeners_(new ObserverListThreadSafe<ServerConnectionEventListener>()),
server_status_(HttpResponse::NONE),
server_reachable_(false),
reset_count_(0),
@@ -155,10 +158,16 @@ ServerConnectionManager::~ServerConnectionManager() {
}
void ServerConnectionManager::NotifyStatusChanged() {
- ServerConnectionEvent event = { ServerConnectionEvent::STATUS_CHANGED,
- server_status_,
- server_reachable_ };
- channel_->NotifyListeners(event);
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kNewSyncerThread)) {
+ listeners_->Notify(&ServerConnectionEventListener::OnServerConnectionEvent,
+ ServerConnectionEvent2(server_status_, server_reachable_));
+ } else {
+ ServerConnectionEvent event = { ServerConnectionEvent::STATUS_CHANGED,
+ server_status_,
+ server_reachable_ };
+ channel_->NotifyListeners(event);
+ }
}
bool ServerConnectionManager::PostBufferWithCachedAuth(
@@ -329,6 +338,16 @@ std::string ServerConnectionManager::GetServerHost() const {
return gurl.host();
}
+void ServerConnectionManager::AddListener(
+ ServerConnectionEventListener* listener) {
+ listeners_->AddObserver(listener);
+}
+
+void ServerConnectionManager::RemoveListener(
+ ServerConnectionEventListener* listener) {
+ listeners_->RemoveObserver(listener);
+}
+
ServerConnectionManager::Post* ServerConnectionManager::MakePost() {
return NULL; // For testing.
}
« no previous file with comments | « chrome/browser/sync/engine/net/server_connection_manager.h ('k') | chrome/browser/sync/engine/syncapi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698