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 "chrome/browser/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
20 #include "base/message_loop/message_loop.h" | 20 #include "base/message_loop/message_loop.h" |
21 #include "base/metrics/histogram.h" | 21 #include "base/metrics/histogram.h" |
22 #include "base/profiler/scoped_profile.h" | 22 #include "base/profiler/scoped_tracker.h" |
23 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
25 #include "base/threading/thread_restrictions.h" | 25 #include "base/threading/thread_restrictions.h" |
26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
27 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | 27 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
28 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
29 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 29 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
30 #include "chrome/browser/chrome_notification_types.h" | 30 #include "chrome/browser/chrome_notification_types.h" |
31 #include "chrome/browser/defaults.h" | 31 #include "chrome/browser/defaults.h" |
32 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 32 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 LOG(ERROR) << "Unexpected persistent error: " << error.ToString(); | 748 LOG(ERROR) << "Unexpected persistent error: " << error.ToString(); |
749 } | 749 } |
750 // Show error to user. | 750 // Show error to user. |
751 UpdateAuthErrorState(error); | 751 UpdateAuthErrorState(error); |
752 } | 752 } |
753 } | 753 } |
754 } | 754 } |
755 | 755 |
756 void ProfileSyncService::OnRefreshTokenAvailable( | 756 void ProfileSyncService::OnRefreshTokenAvailable( |
757 const std::string& account_id) { | 757 const std::string& account_id) { |
758 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. | 758 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed. |
759 tracked_objects::ScopedProfile tracking_profile( | 759 tracked_objects::ScopedTracker tracking_profile( |
760 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 760 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
761 "422460 ProfileSyncService::OnRefreshTokenAvailable")); | 761 "422460 ProfileSyncService::OnRefreshTokenAvailable")); |
762 | 762 |
763 if (account_id == signin_->GetAccountIdToUse()) | 763 if (account_id == signin_->GetAccountIdToUse()) |
764 OnRefreshTokensLoaded(); | 764 OnRefreshTokensLoaded(); |
765 } | 765 } |
766 | 766 |
767 void ProfileSyncService::OnRefreshTokenRevoked( | 767 void ProfileSyncService::OnRefreshTokenRevoked( |
768 const std::string& account_id) { | 768 const std::string& account_id) { |
769 if (!IsOAuthRefreshTokenAvailable()) { | 769 if (!IsOAuthRefreshTokenAvailable()) { |
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2729 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { | 2729 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { |
2730 return device_info_sync_service_->GetLocalDeviceBackupTime(); | 2730 return device_info_sync_service_->GetLocalDeviceBackupTime(); |
2731 } | 2731 } |
2732 | 2732 |
2733 void ProfileSyncService::FlushDirectory() const { | 2733 void ProfileSyncService::FlushDirectory() const { |
2734 // backend_initialized_ implies backend_ isn't NULL and the manager exists. | 2734 // backend_initialized_ implies backend_ isn't NULL and the manager exists. |
2735 // If sync is not initialized yet, we fail silently. | 2735 // If sync is not initialized yet, we fail silently. |
2736 if (backend_initialized_) | 2736 if (backend_initialized_) |
2737 backend_->FlushDirectory(); | 2737 backend_->FlushDirectory(); |
2738 } | 2738 } |
OLD | NEW |