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 "chrome/browser/sync/glue/sync_backend_host.h" | 7 #include "chrome/browser/sync/glue/sync_backend_host.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/sync/notifier/sync_notifier.h" | 26 #include "chrome/browser/sync/notifier/sync_notifier.h" |
27 #include "chrome/browser/sync/protocol/sync.pb.h" | 27 #include "chrome/browser/sync/protocol/sync.pb.h" |
28 #include "chrome/browser/sync/sessions/session_state.h" | 28 #include "chrome/browser/sync/sessions/session_state.h" |
29 // TODO(tim): Remove this! We should have a syncapi pass-thru instead. | 29 // TODO(tim): Remove this! We should have a syncapi pass-thru instead. |
30 #include "chrome/browser/sync/syncable/directory_manager.h" // Cryptographer. | 30 #include "chrome/browser/sync/syncable/directory_manager.h" // Cryptographer. |
31 #include "chrome/browser/sync/sync_prefs.h" | 31 #include "chrome/browser/sync/sync_prefs.h" |
32 #include "chrome/common/chrome_notification_types.h" | 32 #include "chrome/common/chrome_notification_types.h" |
33 #include "chrome/common/chrome_version_info.h" | 33 #include "chrome/common/chrome_version_info.h" |
34 #include "chrome/common/net/gaia/gaia_constants.h" | 34 #include "chrome/common/net/gaia/gaia_constants.h" |
35 #include "content/browser/browser_thread.h" | 35 #include "content/browser/browser_thread.h" |
| 36 #include "content/common/content_client.h" |
36 #include "content/common/notification_service.h" | 37 #include "content/common/notification_service.h" |
37 #include "webkit/glue/webkit_glue.h" | |
38 | 38 |
39 static const int kSaveChangesIntervalSeconds = 10; | 39 static const int kSaveChangesIntervalSeconds = 10; |
40 static const FilePath::CharType kSyncDataFolderName[] = | 40 static const FilePath::CharType kSyncDataFolderName[] = |
41 FILE_PATH_LITERAL("Sync Data"); | 41 FILE_PATH_LITERAL("Sync Data"); |
42 | 42 |
43 typedef TokenService::TokenAvailableDetails TokenAvailableDetails; | 43 typedef TokenService::TokenAvailableDetails TokenAvailableDetails; |
44 | 44 |
45 typedef GoogleServiceAuthError AuthError; | 45 typedef GoogleServiceAuthError AuthError; |
46 | 46 |
47 namespace browser_sync { | 47 namespace browser_sync { |
(...skipping 11 matching lines...) Expand all Loading... |
59 SyncBackendHost::SyncBackendHost(const std::string& name, | 59 SyncBackendHost::SyncBackendHost(const std::string& name, |
60 Profile* profile, | 60 Profile* profile, |
61 SyncPrefs* sync_prefs) | 61 SyncPrefs* sync_prefs) |
62 : core_(new Core(name, ALLOW_THIS_IN_INITIALIZER_LIST(this))), | 62 : core_(new Core(name, ALLOW_THIS_IN_INITIALIZER_LIST(this))), |
63 initialization_state_(NOT_ATTEMPTED), | 63 initialization_state_(NOT_ATTEMPTED), |
64 sync_thread_("Chrome_SyncThread"), | 64 sync_thread_("Chrome_SyncThread"), |
65 frontend_loop_(MessageLoop::current()), | 65 frontend_loop_(MessageLoop::current()), |
66 profile_(profile), | 66 profile_(profile), |
67 sync_prefs_(sync_prefs), | 67 sync_prefs_(sync_prefs), |
68 name_(name), | 68 name_(name), |
69 sync_notifier_factory_(webkit_glue::GetUserAgent(GURL()), | 69 sync_notifier_factory_(content::GetUserAgent(GURL()), |
70 profile_->GetRequestContext(), | 70 profile_->GetRequestContext(), |
71 *CommandLine::ForCurrentProcess()), | 71 *CommandLine::ForCurrentProcess()), |
72 frontend_(NULL), | 72 frontend_(NULL), |
73 sync_data_folder_path_( | 73 sync_data_folder_path_( |
74 profile_->GetPath().Append(kSyncDataFolderName)), | 74 profile_->GetPath().Append(kSyncDataFolderName)), |
75 last_auth_error_(AuthError::None()) { | 75 last_auth_error_(AuthError::None()) { |
76 CHECK(sync_prefs_); | 76 CHECK(sync_prefs_); |
77 } | 77 } |
78 | 78 |
79 SyncBackendHost::SyncBackendHost() | 79 SyncBackendHost::SyncBackendHost() |
80 : initialization_state_(NOT_ATTEMPTED), | 80 : initialization_state_(NOT_ATTEMPTED), |
81 sync_thread_("Chrome_SyncThread"), | 81 sync_thread_("Chrome_SyncThread"), |
82 frontend_loop_(MessageLoop::current()), | 82 frontend_loop_(MessageLoop::current()), |
83 profile_(NULL), | 83 profile_(NULL), |
84 sync_prefs_(NULL), | 84 sync_prefs_(NULL), |
85 name_("Unknown"), | 85 name_("Unknown"), |
86 sync_notifier_factory_(webkit_glue::GetUserAgent(GURL()), | 86 sync_notifier_factory_(content::GetUserAgent(GURL()), |
87 NULL, | 87 NULL, |
88 *CommandLine::ForCurrentProcess()), | 88 *CommandLine::ForCurrentProcess()), |
89 frontend_(NULL), | 89 frontend_(NULL), |
90 last_auth_error_(AuthError::None()) { | 90 last_auth_error_(AuthError::None()) { |
91 } | 91 } |
92 | 92 |
93 SyncBackendHost::~SyncBackendHost() { | 93 SyncBackendHost::~SyncBackendHost() { |
94 DCHECK(!core_ && !frontend_) << "Must call Shutdown before destructor."; | 94 DCHECK(!core_ && !frontend_) << "Must call Shutdown before destructor."; |
95 DCHECK(!registrar_.get()); | 95 DCHECK(!registrar_.get()); |
96 } | 96 } |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 FROM_HERE, | 1024 FROM_HERE, |
1025 base::Bind(&SyncBackendHost::Core::DoRefreshEncryption, | 1025 base::Bind(&SyncBackendHost::Core::DoRefreshEncryption, |
1026 core_.get(), sync_thread_done_callback)); | 1026 core_.get(), sync_thread_done_callback)); |
1027 } | 1027 } |
1028 | 1028 |
1029 #undef SVLOG | 1029 #undef SVLOG |
1030 | 1030 |
1031 #undef SLOG | 1031 #undef SLOG |
1032 | 1032 |
1033 } // namespace browser_sync | 1033 } // namespace browser_sync |
OLD | NEW |