| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 void ProfileSyncService::Initialize() { | 132 void ProfileSyncService::Initialize() { |
| 133 InitSettings(); | 133 InitSettings(); |
| 134 RegisterPreferences(); | 134 RegisterPreferences(); |
| 135 | 135 |
| 136 // We clear this here (vs Shutdown) because we want to remember that an error | 136 // We clear this here (vs Shutdown) because we want to remember that an error |
| 137 // happened on shutdown so we can display details (message, location) about it | 137 // happened on shutdown so we can display details (message, location) about it |
| 138 // in about:sync. | 138 // in about:sync. |
| 139 unrecoverable_error_detected_ = false; | 139 unrecoverable_error_detected_ = false; |
| 140 unrecoverable_error_message_.clear(); | 140 unrecoverable_error_message_.clear(); |
| 141 unrecoverable_error_location_.reset(); | 141 unrecoverable_error_location_ = tracked_objects::Location(); |
| 142 | 142 |
| 143 // Watch the preference that indicates sync is managed so we can take | 143 // Watch the preference that indicates sync is managed so we can take |
| 144 // appropriate action. | 144 // appropriate action. |
| 145 pref_sync_managed_.Init(prefs::kSyncManaged, profile_->GetPrefs(), this); | 145 pref_sync_managed_.Init(prefs::kSyncManaged, profile_->GetPrefs(), this); |
| 146 | 146 |
| 147 // For now, the only thing we can do through policy is to turn sync off. | 147 // For now, the only thing we can do through policy is to turn sync off. |
| 148 if (IsManaged()) { | 148 if (IsManaged()) { |
| 149 DisableForUser(); | 149 DisableForUser(); |
| 150 return; | 150 return; |
| 151 } | 151 } |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 NOTREACHED(); | 587 NOTREACHED(); |
| 588 } | 588 } |
| 589 | 589 |
| 590 // An invariant has been violated. Transition to an error state where we try | 590 // An invariant has been violated. Transition to an error state where we try |
| 591 // to do as little work as possible, to avoid further corruption or crashes. | 591 // to do as little work as possible, to avoid further corruption or crashes. |
| 592 void ProfileSyncService::OnUnrecoverableError( | 592 void ProfileSyncService::OnUnrecoverableError( |
| 593 const tracked_objects::Location& from_here, | 593 const tracked_objects::Location& from_here, |
| 594 const std::string& message) { | 594 const std::string& message) { |
| 595 unrecoverable_error_detected_ = true; | 595 unrecoverable_error_detected_ = true; |
| 596 unrecoverable_error_message_ = message; | 596 unrecoverable_error_message_ = message; |
| 597 unrecoverable_error_location_.reset( | 597 unrecoverable_error_location_ = from_here; |
| 598 new tracked_objects::Location(from_here.function_name(), | |
| 599 from_here.file_name(), | |
| 600 from_here.line_number(), | |
| 601 from_here.program_counter())); | |
| 602 | 598 |
| 603 // Tell the wizard so it can inform the user only if it is already open. | 599 // Tell the wizard so it can inform the user only if it is already open. |
| 604 wizard_.Step(SyncSetupWizard::FATAL_ERROR); | 600 wizard_.Step(SyncSetupWizard::FATAL_ERROR); |
| 605 | 601 |
| 606 NotifyObservers(); | 602 NotifyObservers(); |
| 607 LOG(ERROR) << "Unrecoverable error detected -- ProfileSyncService unusable." | 603 LOG(ERROR) << "Unrecoverable error detected -- ProfileSyncService unusable." |
| 608 << message; | 604 << message; |
| 609 std::string location; | 605 std::string location; |
| 610 from_here.Write(true, true, &location); | 606 from_here.Write(true, true, &location); |
| 611 LOG(ERROR) << location; | 607 LOG(ERROR) << location; |
| (...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1574 *profile_->GetPrefs()->GetList(prefs::kAcknowledgedSyncTypes)); | 1570 *profile_->GetPrefs()->GetList(prefs::kAcknowledgedSyncTypes)); |
| 1575 syncable::ModelTypeSet registered; | 1571 syncable::ModelTypeSet registered; |
| 1576 GetRegisteredDataTypes(®istered); | 1572 GetRegisteredDataTypes(®istered); |
| 1577 syncable::ModelTypeBitSet registered_bit_set = | 1573 syncable::ModelTypeBitSet registered_bit_set = |
| 1578 syncable::ModelTypeBitSetFromSet(registered); | 1574 syncable::ModelTypeBitSetFromSet(registered); |
| 1579 unacknowledged = registered_bit_set & ~acknowledged; | 1575 unacknowledged = registered_bit_set & ~acknowledged; |
| 1580 } | 1576 } |
| 1581 return unacknowledged; | 1577 return unacknowledged; |
| 1582 } | 1578 } |
| 1583 | 1579 |
| OLD | NEW |