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

Unified Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 9550009: [Sync] Move dependency on Chrome switches from SyncNotifierFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to head Created 8 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/glue/sync_backend_host.h ('k') | chrome/browser/sync/notifier/sync_notifier_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/sync_backend_host.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index 4328cbf7a7d5afb4c4b397659938f5193623d1f7..0525d2fee0a43a4fe85d6f90009b421611153d26 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -42,6 +42,10 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/common/content_client.h"
+#include "jingle/notifier/base/notification_method.h"
+#include "jingle/notifier/base/notifier_options.h"
+#include "net/base/host_port_pair.h"
+#include "net/url_request/url_request_context_getter.h"
static const int kSaveChangesIntervalSeconds = 10;
static const FilePath::CharType kSyncDataFolderName[] =
@@ -226,6 +230,52 @@ class SyncBackendHost::Core
DISALLOW_COPY_AND_ASSIGN(Core);
};
+namespace {
+
+// Parses the given command line for notifier options.
+notifier::NotifierOptions ParseNotifierOptions(
+ const CommandLine& command_line,
+ const scoped_refptr<net::URLRequestContextGetter>&
+ request_context_getter) {
+ notifier::NotifierOptions notifier_options;
+ notifier_options.request_context_getter = request_context_getter;
+
+ if (command_line.HasSwitch(switches::kSyncNotificationHostPort)) {
+ notifier_options.xmpp_host_port =
+ net::HostPortPair::FromString(
+ command_line.GetSwitchValueASCII(
+ switches::kSyncNotificationHostPort));
+ DVLOG(1) << "Using " << notifier_options.xmpp_host_port.ToString()
+ << " for test sync notification server.";
+ }
+
+ notifier_options.try_ssltcp_first =
+ command_line.HasSwitch(switches::kSyncTrySsltcpFirstForXmpp);
+ DVLOG_IF(1, notifier_options.try_ssltcp_first)
+ << "Trying SSL/TCP port before XMPP port for notifications.";
+
+ notifier_options.invalidate_xmpp_login =
+ command_line.HasSwitch(switches::kSyncInvalidateXmppLogin);
+ DVLOG_IF(1, notifier_options.invalidate_xmpp_login)
+ << "Invalidating sync XMPP login.";
+
+ notifier_options.allow_insecure_connection =
+ command_line.HasSwitch(switches::kSyncAllowInsecureXmppConnection);
+ DVLOG_IF(1, notifier_options.allow_insecure_connection)
+ << "Allowing insecure XMPP connections.";
+
+ if (command_line.HasSwitch(switches::kSyncNotificationMethod)) {
+ const std::string notification_method_str(
+ command_line.GetSwitchValueASCII(switches::kSyncNotificationMethod));
+ notifier_options.notification_method =
+ notifier::StringToNotificationMethod(notification_method_str);
+ }
+
+ return notifier_options;
+}
+
+} // namespace
+
SyncBackendHost::SyncBackendHost(const std::string& name,
Profile* profile,
const base::WeakPtr<SyncPrefs>& sync_prefs)
@@ -240,10 +290,10 @@ SyncBackendHost::SyncBackendHost(const std::string& name,
sync_prefs_(sync_prefs),
chrome_sync_notification_bridge_(profile_),
sync_notifier_factory_(
+ ParseNotifierOptions(*CommandLine::ForCurrentProcess(),
+ profile_->GetRequestContext()),
content::GetUserAgent(GURL()),
- profile_->GetRequestContext(),
- sync_prefs,
- *CommandLine::ForCurrentProcess()),
+ sync_prefs),
frontend_(NULL),
last_auth_error_(AuthError::None()) {
}
@@ -257,10 +307,10 @@ SyncBackendHost::SyncBackendHost(Profile* profile)
initialization_state_(NOT_ATTEMPTED),
chrome_sync_notification_bridge_(profile_),
sync_notifier_factory_(
+ ParseNotifierOptions(*CommandLine::ForCurrentProcess(),
+ profile_->GetRequestContext()),
content::GetUserAgent(GURL()),
- NULL,
- base::WeakPtr<sync_notifier::InvalidationVersionTracker>(),
- *CommandLine::ForCurrentProcess()),
+ base::WeakPtr<sync_notifier::InvalidationVersionTracker>()),
frontend_(NULL),
last_auth_error_(AuthError::None()) {
}
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host.h ('k') | chrome/browser/sync/notifier/sync_notifier_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698