| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/sync/glue/password_model_worker.h" | 26 #include "chrome/browser/sync/glue/password_model_worker.h" |
| 27 #include "chrome/browser/sync/glue/sync_backend_host.h" | 27 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 28 #include "chrome/browser/sync/js_arg_list.h" | 28 #include "chrome/browser/sync/js_arg_list.h" |
| 29 #include "chrome/browser/sync/js_event_details.h" | 29 #include "chrome/browser/sync/js_event_details.h" |
| 30 #include "chrome/browser/sync/notifier/sync_notifier.h" | 30 #include "chrome/browser/sync/notifier/sync_notifier.h" |
| 31 #include "chrome/browser/sync/sessions/session_state.h" | 31 #include "chrome/browser/sync/sessions/session_state.h" |
| 32 // TODO(tim): Remove this! We should have a syncapi pass-thru instead. | 32 // TODO(tim): Remove this! We should have a syncapi pass-thru instead. |
| 33 #include "chrome/browser/sync/syncable/directory_manager.h" // Cryptographer. | 33 #include "chrome/browser/sync/syncable/directory_manager.h" // Cryptographer. |
| 34 #include "chrome/browser/sync/syncable/model_type.h" | 34 #include "chrome/browser/sync/syncable/model_type.h" |
| 35 #include "chrome/browser/sync/syncable/nigori_util.h" | 35 #include "chrome/browser/sync/syncable/nigori_util.h" |
| 36 #include "chrome/common/chrome_notification_types.h" |
| 36 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
| 37 #include "chrome/common/chrome_version_info.h" | 38 #include "chrome/common/chrome_version_info.h" |
| 38 #include "chrome/common/net/gaia/gaia_constants.h" | 39 #include "chrome/common/net/gaia/gaia_constants.h" |
| 39 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
| 40 #include "content/browser/browser_thread.h" | 41 #include "content/browser/browser_thread.h" |
| 41 #include "content/common/notification_service.h" | 42 #include "content/common/notification_service.h" |
| 42 #include "content/common/notification_type.h" | |
| 43 #include "googleurl/src/gurl.h" | 43 #include "googleurl/src/gurl.h" |
| 44 #include "webkit/glue/webkit_glue.h" | 44 #include "webkit/glue/webkit_glue.h" |
| 45 | 45 |
| 46 static const int kSaveChangesIntervalSeconds = 10; | 46 static const int kSaveChangesIntervalSeconds = 10; |
| 47 static const FilePath::CharType kSyncDataFolderName[] = | 47 static const FilePath::CharType kSyncDataFolderName[] = |
| 48 FILE_PATH_LITERAL("Sync Data"); | 48 FILE_PATH_LITERAL("Sync Data"); |
| 49 | 49 |
| 50 using browser_sync::DataTypeController; | 50 using browser_sync::DataTypeController; |
| 51 typedef TokenService::TokenAvailableDetails TokenAvailableDetails; | 51 typedef TokenService::TokenAvailableDetails TokenAvailableDetails; |
| 52 | 52 |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 host_->PersistEncryptionBootstrapToken(bootstrap_token); | 530 host_->PersistEncryptionBootstrapToken(bootstrap_token); |
| 531 host_->frontend_->OnPassphraseAccepted(); | 531 host_->frontend_->OnPassphraseAccepted(); |
| 532 } | 532 } |
| 533 | 533 |
| 534 void SyncBackendHost::Core::NotifyUpdatedToken(const std::string& token) { | 534 void SyncBackendHost::Core::NotifyUpdatedToken(const std::string& token) { |
| 535 if (!host_) | 535 if (!host_) |
| 536 return; | 536 return; |
| 537 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 537 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 538 TokenAvailableDetails details(GaiaConstants::kSyncService, token); | 538 TokenAvailableDetails details(GaiaConstants::kSyncService, token); |
| 539 NotificationService::current()->Notify( | 539 NotificationService::current()->Notify( |
| 540 NotificationType::TOKEN_UPDATED, | 540 chrome::NOTIFICATION_TOKEN_UPDATED, |
| 541 NotificationService::AllSources(), | 541 NotificationService::AllSources(), |
| 542 Details<const TokenAvailableDetails>(&details)); | 542 Details<const TokenAvailableDetails>(&details)); |
| 543 } | 543 } |
| 544 | 544 |
| 545 void SyncBackendHost::Core::NotifyEncryptionComplete( | 545 void SyncBackendHost::Core::NotifyEncryptionComplete( |
| 546 const syncable::ModelTypeSet& encrypted_types) { | 546 const syncable::ModelTypeSet& encrypted_types) { |
| 547 if (!host_) | 547 if (!host_) |
| 548 return; | 548 return; |
| 549 DCHECK_EQ(MessageLoop::current(), host_->frontend_loop_); | 549 DCHECK_EQ(MessageLoop::current(), host_->frontend_loop_); |
| 550 host_->frontend_->OnEncryptionComplete(encrypted_types); | 550 host_->frontend_->OnEncryptionComplete(encrypted_types); |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 DCHECK_EQ(MessageLoop::current(), host_->sync_thread_.message_loop()); | 1158 DCHECK_EQ(MessageLoop::current(), host_->sync_thread_.message_loop()); |
| 1159 sync_manager_->GetJsBackend()->ProcessMessage(name, args, sender); | 1159 sync_manager_->GetJsBackend()->ProcessMessage(name, args, sender); |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 void SyncBackendHost::Core::DeferNudgeForCleanup() { | 1162 void SyncBackendHost::Core::DeferNudgeForCleanup() { |
| 1163 DCHECK_EQ(MessageLoop::current(), host_->sync_thread_.message_loop()); | 1163 DCHECK_EQ(MessageLoop::current(), host_->sync_thread_.message_loop()); |
| 1164 deferred_nudge_for_cleanup_requested_ = true; | 1164 deferred_nudge_for_cleanup_requested_ = true; |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 } // namespace browser_sync | 1167 } // namespace browser_sync |
| OLD | NEW |