Chromium Code Reviews| 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 "chrome/browser/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1469 break; | 1469 break; |
| 1470 } | 1470 } |
| 1471 case chrome::NOTIFICATION_TOKEN_AVAILABLE: { | 1471 case chrome::NOTIFICATION_TOKEN_AVAILABLE: { |
| 1472 const TokenService::TokenAvailableDetails& token_details = | 1472 const TokenService::TokenAvailableDetails& token_details = |
| 1473 *(content::Details<const TokenService::TokenAvailableDetails>( | 1473 *(content::Details<const TokenService::TokenAvailableDetails>( |
| 1474 details).ptr()); | 1474 details).ptr()); |
| 1475 if (IsTokenServiceRelevant(token_details.service()) && | 1475 if (IsTokenServiceRelevant(token_details.service()) && |
| 1476 AreCredentialsAvailable(true)) { | 1476 AreCredentialsAvailable(true)) { |
| 1477 if (backend_initialized_) { | 1477 if (backend_initialized_) { |
| 1478 backend_->UpdateCredentials(GetCredentials()); | 1478 backend_->UpdateCredentials(GetCredentials()); |
| 1479 const GoogleServiceAuthError& last_error = GetAuthError(); | |
| 1480 if (GoogleServiceAuthError::NONE == last_error.state()) { | |
| 1481 // SyncBackendHost::UpdateCredentials call does not call back | |
| 1482 // OnAuthError in cases when the underlying syncer state does not | |
| 1483 // change. Due to that if the login dialog is showing up when the | |
| 1484 // credentials have not expired as such (this happens when login | |
| 1485 // dialog is shown by app notifications setup code) the login dialog | |
| 1486 // will show the spinner forever. Hence, we call OnAuthError | |
| 1487 // explicitly here to avoid the infinite spinner in that case. | |
| 1488 // Note that SyncBackendHost::UpdateCredentials may actually end up | |
| 1489 // failing, but in that case an error will be shown to the user in | |
| 1490 // bookmarks bar and preferences. | |
| 1491 OnAuthError(); | |
|
tim (not reviewing)
2011/12/06 23:39:31
Why did we do this this way? From my email, I sug
Munjal (Google)
2011/12/07 00:05:14
The main reason is that this seemed the safest (lo
| |
| 1492 } | |
| 1479 } | 1493 } |
| 1480 if (!sync_prefs_.IsStartSuppressed()) | 1494 if (!sync_prefs_.IsStartSuppressed()) |
| 1481 StartUp(); | 1495 StartUp(); |
| 1482 } | 1496 } |
| 1483 break; | 1497 break; |
| 1484 } | 1498 } |
| 1485 case chrome::NOTIFICATION_TOKEN_LOADING_FINISHED: { | 1499 case chrome::NOTIFICATION_TOKEN_LOADING_FINISHED: { |
| 1486 // This notification gets fired when TokenService loads the tokens | 1500 // This notification gets fired when TokenService loads the tokens |
| 1487 // from storage. Here we only check if the chromiumsync token is | 1501 // from storage. Here we only check if the chromiumsync token is |
| 1488 // available (versus both chromiumsync and oauth login tokens) to | 1502 // available (versus both chromiumsync and oauth login tokens) to |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1593 << "Unrecoverable error."; | 1607 << "Unrecoverable error."; |
| 1594 } else { | 1608 } else { |
| 1595 DVLOG(0) << "ConfigureDataTypeManager not invoked because backend is not " | 1609 DVLOG(0) << "ConfigureDataTypeManager not invoked because backend is not " |
| 1596 << "initialized"; | 1610 << "initialized"; |
| 1597 } | 1611 } |
| 1598 } | 1612 } |
| 1599 | 1613 |
| 1600 const FailedDatatypesHandler& ProfileSyncService::failed_datatypes_handler() { | 1614 const FailedDatatypesHandler& ProfileSyncService::failed_datatypes_handler() { |
| 1601 return failed_datatypes_handler_; | 1615 return failed_datatypes_handler_; |
| 1602 } | 1616 } |
| OLD | NEW |