| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "chrome/browser/sync/protocol/service_constants.h" | 37 #include "chrome/browser/sync/protocol/service_constants.h" |
| 38 #include "chrome/browser/sync/sessions/sync_session_context.h" | 38 #include "chrome/browser/sync/sessions/sync_session_context.h" |
| 39 #include "chrome/browser/sync/syncable/directory_manager.h" | 39 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 40 #include "chrome/browser/sync/syncable/syncable.h" | 40 #include "chrome/browser/sync/syncable/syncable.h" |
| 41 #include "chrome/browser/sync/util/character_set_converters.h" | 41 #include "chrome/browser/sync/util/character_set_converters.h" |
| 42 #include "chrome/browser/sync/util/closure.h" | 42 #include "chrome/browser/sync/util/closure.h" |
| 43 #include "chrome/browser/sync/util/crypto_helpers.h" | 43 #include "chrome/browser/sync/util/crypto_helpers.h" |
| 44 #include "chrome/browser/sync/util/event_sys.h" | 44 #include "chrome/browser/sync/util/event_sys.h" |
| 45 #include "chrome/browser/sync/util/path_helpers.h" | 45 #include "chrome/browser/sync/util/path_helpers.h" |
| 46 #include "chrome/browser/sync/util/user_settings.h" | 46 #include "chrome/browser/sync/util/user_settings.h" |
| 47 #include "chrome/common/chrome_switches.h" |
| 47 | 48 |
| 48 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
| 49 #pragma comment(lib, "iphlpapi.lib") | 50 #pragma comment(lib, "iphlpapi.lib") |
| 50 #endif | 51 #endif |
| 51 | 52 |
| 52 using browser_sync::AllStatus; | 53 using browser_sync::AllStatus; |
| 53 using browser_sync::AllStatusEvent; | 54 using browser_sync::AllStatusEvent; |
| 54 using browser_sync::AuthWatcher; | 55 using browser_sync::AuthWatcher; |
| 55 using browser_sync::AuthWatcherEvent; | 56 using browser_sync::AuthWatcherEvent; |
| 56 using browser_sync::Syncer; | 57 using browser_sync::Syncer; |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 syncer_thread()->Start(); // Start the syncer thread. This won't actually | 1015 syncer_thread()->Start(); // Start the syncer thread. This won't actually |
| 1015 // result in any syncing until at least the | 1016 // result in any syncing until at least the |
| 1016 // DirectoryManager broadcasts the OPENED event, | 1017 // DirectoryManager broadcasts the OPENED event, |
| 1017 // and a valid server connection is detected. | 1018 // and a valid server connection is detected. |
| 1018 | 1019 |
| 1019 bool attempting_auth = false; | 1020 bool attempting_auth = false; |
| 1020 std::string username, auth_token; | 1021 std::string username, auth_token; |
| 1021 if (attempt_last_user_authentication && | 1022 if (attempt_last_user_authentication && |
| 1022 auth_watcher()->settings()->GetLastUserAndServiceToken( | 1023 auth_watcher()->settings()->GetLastUserAndServiceToken( |
| 1023 SYNC_SERVICE_NAME, &username, &auth_token)) { | 1024 SYNC_SERVICE_NAME, &username, &auth_token)) { |
| 1025 #ifndef NDEBUG |
| 1026 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 1027 if (command_line.HasSwitch(switches::kInvalidateSyncLogin)) { |
| 1028 auth_token += "bogus"; |
| 1029 } |
| 1030 #endif |
| 1024 attempting_auth = AuthenticateForUser(username, auth_token); | 1031 attempting_auth = AuthenticateForUser(username, auth_token); |
| 1025 } else if (!lsid.empty()) { | 1032 } else if (!lsid.empty()) { |
| 1026 attempting_auth = true; | 1033 attempting_auth = true; |
| 1027 AuthenticateWithLsid(lsid); | 1034 AuthenticateWithLsid(lsid); |
| 1028 } | 1035 } |
| 1029 if (!attempting_auth) | 1036 if (!attempting_auth) |
| 1030 RaiseAuthNeededEvent(); | 1037 RaiseAuthNeededEvent(); |
| 1031 return true; | 1038 return true; |
| 1032 } | 1039 } |
| 1033 | 1040 |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 BaseTransaction::~BaseTransaction() { | 1531 BaseTransaction::~BaseTransaction() { |
| 1525 delete lookup_; | 1532 delete lookup_; |
| 1526 } | 1533 } |
| 1527 | 1534 |
| 1528 UserShare* SyncManager::GetUserShare() const { | 1535 UserShare* SyncManager::GetUserShare() const { |
| 1529 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; | 1536 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; |
| 1530 return data_->GetUserShare(); | 1537 return data_->GetUserShare(); |
| 1531 } | 1538 } |
| 1532 | 1539 |
| 1533 } // namespace sync_api | 1540 } // namespace sync_api |
| OLD | NEW |