OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_file_system/local/local_file_sync_service.h" | 5 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h" |
6 | 6 |
| 7 #include "base/single_thread_task_runner.h" |
7 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/thread_task_runner_handle.h" |
8 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
9 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sync_file_system/file_change.h" | 12 #include "chrome/browser/sync_file_system/file_change.h" |
11 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" | 13 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
12 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 14 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
13 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 15 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
14 #include "chrome/browser/sync_file_system/local_change_processor.h" | 16 #include "chrome/browser/sync_file_system/local_change_processor.h" |
15 #include "chrome/browser/sync_file_system/logger.h" | 17 #include "chrome/browser/sync_file_system/logger.h" |
16 #include "chrome/browser/sync_file_system/sync_file_metadata.h" | 18 #include "chrome/browser/sync_file_system/sync_file_metadata.h" |
17 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 170 |
169 void LocalFileSyncService::SetLocalChangeProcessorCallback( | 171 void LocalFileSyncService::SetLocalChangeProcessorCallback( |
170 const GetLocalChangeProcessorCallback& get_local_change_processor) { | 172 const GetLocalChangeProcessorCallback& get_local_change_processor) { |
171 get_local_change_processor_ = get_local_change_processor; | 173 get_local_change_processor_ = get_local_change_processor; |
172 } | 174 } |
173 | 175 |
174 void LocalFileSyncService::HasPendingLocalChanges( | 176 void LocalFileSyncService::HasPendingLocalChanges( |
175 const FileSystemURL& url, | 177 const FileSystemURL& url, |
176 const HasPendingLocalChangeCallback& callback) { | 178 const HasPendingLocalChangeCallback& callback) { |
177 if (!ContainsKey(origin_to_contexts_, url.origin())) { | 179 if (!ContainsKey(origin_to_contexts_, url.origin())) { |
178 base::MessageLoopProxy::current()->PostTask( | 180 base::ThreadTaskRunnerHandle::Get()->PostTask( |
179 FROM_HERE, | 181 FROM_HERE, |
180 base::Bind(callback, SYNC_FILE_ERROR_INVALID_URL, false)); | 182 base::Bind(callback, SYNC_FILE_ERROR_INVALID_URL, false)); |
181 return; | 183 return; |
182 } | 184 } |
183 sync_context_->HasPendingLocalChanges( | 185 sync_context_->HasPendingLocalChanges( |
184 origin_to_contexts_[url.origin()], url, callback); | 186 origin_to_contexts_[url.origin()], url, callback); |
185 } | 187 } |
186 | 188 |
187 void LocalFileSyncService::PromoteDemotedChanges() { | 189 void LocalFileSyncService::PromoteDemotedChanges() { |
188 for (OriginToContext::iterator iter = origin_to_contexts_.begin(); | 190 for (OriginToContext::iterator iter = origin_to_contexts_.begin(); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 | 484 |
483 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor( | 485 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor( |
484 const FileSystemURL& url) { | 486 const FileSystemURL& url) { |
485 if (!get_local_change_processor_.is_null()) | 487 if (!get_local_change_processor_.is_null()) |
486 return get_local_change_processor_.Run(url.origin()); | 488 return get_local_change_processor_.Run(url.origin()); |
487 DCHECK(local_change_processor_); | 489 DCHECK(local_change_processor_); |
488 return local_change_processor_; | 490 return local_change_processor_; |
489 } | 491 } |
490 | 492 |
491 } // namespace sync_file_system | 493 } // namespace sync_file_system |
OLD | NEW |