| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/glue/sync_backend_host.h" | 7 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/timer.h" | 21 #include "base/timer.h" |
| 22 #include "base/tracked_objects.h" | 22 #include "base/tracked_objects.h" |
| 23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/signin/token_service.h" | 25 #include "chrome/browser/signin/token_service.h" |
| 26 #include "chrome/browser/sync/glue/bridged_sync_notifier.h" | 26 #include "chrome/browser/sync/glue/bridged_sync_notifier.h" |
| 27 #include "chrome/browser/sync/glue/change_processor.h" | 27 #include "chrome/browser/sync/glue/change_processor.h" |
| 28 #include "chrome/browser/sync/glue/chrome_encryptor.h" | 28 #include "chrome/browser/sync/glue/chrome_encryptor.h" |
| 29 #include "chrome/browser/sync/glue/http_bridge.h" | 29 #include "chrome/browser/sync/glue/http_bridge.h" |
| 30 #include "chrome/browser/sync/glue/sync_backend_registrar.h" | 30 #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
| 31 #include "chrome/browser/sync/invalidations/invalidator_storage.h" |
| 31 #include "chrome/browser/sync/sync_prefs.h" | 32 #include "chrome/browser/sync/sync_prefs.h" |
| 32 #include "chrome/common/chrome_notification_types.h" | 33 #include "chrome/common/chrome_notification_types.h" |
| 33 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/common/chrome_version_info.h" | 35 #include "chrome/common/chrome_version_info.h" |
| 35 #include "chrome/common/net/gaia/gaia_constants.h" | 36 #include "chrome/common/net/gaia/gaia_constants.h" |
| 36 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
| 37 #include "content/public/browser/notification_service.h" | 38 #include "content/public/browser/notification_service.h" |
| 38 #include "content/public/common/content_client.h" | 39 #include "content/public/common/content_client.h" |
| 39 #include "jingle/notifier/base/notification_method.h" | 40 #include "jingle/notifier/base/notification_method.h" |
| 40 #include "jingle/notifier/base/notifier_options.h" | 41 #include "jingle/notifier/base/notifier_options.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 command_line.GetSwitchValueASCII(switches::kSyncNotificationMethod)); | 273 command_line.GetSwitchValueASCII(switches::kSyncNotificationMethod)); |
| 273 notifier_options.notification_method = | 274 notifier_options.notification_method = |
| 274 notifier::StringToNotificationMethod(notification_method_str); | 275 notifier::StringToNotificationMethod(notification_method_str); |
| 275 } | 276 } |
| 276 | 277 |
| 277 return notifier_options; | 278 return notifier_options; |
| 278 } | 279 } |
| 279 | 280 |
| 280 } // namespace | 281 } // namespace |
| 281 | 282 |
| 282 SyncBackendHost::SyncBackendHost(const std::string& name, | 283 SyncBackendHost::SyncBackendHost( |
| 283 Profile* profile, | 284 const std::string& name, |
| 284 const base::WeakPtr<SyncPrefs>& sync_prefs) | 285 Profile* profile, |
| 286 const base::WeakPtr<SyncPrefs>& sync_prefs, |
| 287 const base::WeakPtr<InvalidatorStorage>& invalidator_storage) |
| 285 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 288 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 286 sync_thread_("Chrome_SyncThread"), | 289 sync_thread_("Chrome_SyncThread"), |
| 287 frontend_loop_(MessageLoop::current()), | 290 frontend_loop_(MessageLoop::current()), |
| 288 profile_(profile), | 291 profile_(profile), |
| 289 name_(name), | 292 name_(name), |
| 290 core_(new Core(name, profile_->GetPath().Append(kSyncDataFolderName), | 293 core_(new Core(name, profile_->GetPath().Append(kSyncDataFolderName), |
| 291 weak_ptr_factory_.GetWeakPtr())), | 294 weak_ptr_factory_.GetWeakPtr())), |
| 292 initialization_state_(NOT_ATTEMPTED), | 295 initialization_state_(NOT_ATTEMPTED), |
| 293 sync_prefs_(sync_prefs), | 296 sync_prefs_(sync_prefs), |
| 294 chrome_sync_notification_bridge_(profile_), | 297 chrome_sync_notification_bridge_(profile_), |
| 295 sync_notifier_factory_( | 298 sync_notifier_factory_( |
| 296 ParseNotifierOptions(*CommandLine::ForCurrentProcess(), | 299 ParseNotifierOptions(*CommandLine::ForCurrentProcess(), |
| 297 profile_->GetRequestContext()), | 300 profile_->GetRequestContext()), |
| 298 content::GetUserAgent(GURL()), | 301 content::GetUserAgent(GURL()), |
| 299 sync_prefs), | 302 invalidator_storage), |
| 300 frontend_(NULL) { | 303 frontend_(NULL) { |
| 301 } | 304 } |
| 302 | 305 |
| 303 SyncBackendHost::SyncBackendHost(Profile* profile) | 306 SyncBackendHost::SyncBackendHost(Profile* profile) |
| 304 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 307 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 305 sync_thread_("Chrome_SyncThread"), | 308 sync_thread_("Chrome_SyncThread"), |
| 306 frontend_loop_(MessageLoop::current()), | 309 frontend_loop_(MessageLoop::current()), |
| 307 profile_(profile), | 310 profile_(profile), |
| 308 name_("Unknown"), | 311 name_("Unknown"), |
| 309 initialization_state_(NOT_ATTEMPTED), | 312 initialization_state_(NOT_ATTEMPTED), |
| (...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1438 FROM_HERE, | 1441 FROM_HERE, |
| 1439 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, | 1442 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, |
| 1440 core_.get(), sync_thread_done_callback)); | 1443 core_.get(), sync_thread_done_callback)); |
| 1441 } | 1444 } |
| 1442 | 1445 |
| 1443 #undef SDVLOG | 1446 #undef SDVLOG |
| 1444 | 1447 |
| 1445 #undef SLOG | 1448 #undef SLOG |
| 1446 | 1449 |
| 1447 } // namespace browser_sync | 1450 } // namespace browser_sync |
| OLD | NEW |