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/single_thread_task_runner.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 scoped_ptr<LocalFileSyncService> LocalFileSyncService::CreateForTesting( | 113 scoped_ptr<LocalFileSyncService> LocalFileSyncService::CreateForTesting( |
114 Profile* profile, | 114 Profile* profile, |
115 leveldb::Env* env) { | 115 leveldb::Env* env) { |
116 scoped_ptr<LocalFileSyncService> sync_service( | 116 scoped_ptr<LocalFileSyncService> sync_service( |
117 new LocalFileSyncService(profile, env)); | 117 new LocalFileSyncService(profile, env)); |
118 sync_service->sync_context_->set_mock_notify_changes_duration_in_sec(0); | 118 sync_service->sync_context_->set_mock_notify_changes_duration_in_sec(0); |
119 return sync_service.Pass(); | 119 return sync_service.Pass(); |
120 } | 120 } |
121 | 121 |
122 LocalFileSyncService::~LocalFileSyncService() { | 122 LocalFileSyncService::~LocalFileSyncService() { |
123 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 123 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
124 } | 124 } |
125 | 125 |
126 void LocalFileSyncService::Shutdown() { | 126 void LocalFileSyncService::Shutdown() { |
127 sync_context_->RemoveOriginChangeObserver(this); | 127 sync_context_->RemoveOriginChangeObserver(this); |
128 sync_context_->ShutdownOnUIThread(); | 128 sync_context_->ShutdownOnUIThread(); |
129 profile_ = nullptr; | 129 profile_ = nullptr; |
130 } | 130 } |
131 | 131 |
132 void LocalFileSyncService::MaybeInitializeFileSystemContext( | 132 void LocalFileSyncService::MaybeInitializeFileSystemContext( |
133 const GURL& app_origin, | 133 const GURL& app_origin, |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 LocalFileSyncService::LocalFileSyncService(Profile* profile, | 343 LocalFileSyncService::LocalFileSyncService(Profile* profile, |
344 leveldb::Env* env_override) | 344 leveldb::Env* env_override) |
345 : profile_(profile), | 345 : profile_(profile), |
346 sync_context_(new LocalFileSyncContext( | 346 sync_context_(new LocalFileSyncContext( |
347 profile_->GetPath(), | 347 profile_->GetPath(), |
348 env_override, | 348 env_override, |
349 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI).get(), | 349 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI).get(), |
350 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO) | 350 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO) |
351 .get())), | 351 .get())), |
352 local_change_processor_(nullptr) { | 352 local_change_processor_(nullptr) { |
353 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 353 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
354 sync_context_->AddOriginChangeObserver(this); | 354 sync_context_->AddOriginChangeObserver(this); |
355 } | 355 } |
356 | 356 |
357 void LocalFileSyncService::DidInitializeFileSystemContext( | 357 void LocalFileSyncService::DidInitializeFileSystemContext( |
358 const GURL& app_origin, | 358 const GURL& app_origin, |
359 storage::FileSystemContext* file_system_context, | 359 storage::FileSystemContext* file_system_context, |
360 const SyncStatusCallback& callback, | 360 const SyncStatusCallback& callback, |
361 SyncStatusCode status) { | 361 SyncStatusCode status) { |
362 if (status != SYNC_STATUS_OK) { | 362 if (status != SYNC_STATUS_OK) { |
363 callback.Run(status); | 363 callback.Run(status); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 491 |
492 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor( | 492 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor( |
493 const FileSystemURL& url) { | 493 const FileSystemURL& url) { |
494 if (!get_local_change_processor_.is_null()) | 494 if (!get_local_change_processor_.is_null()) |
495 return get_local_change_processor_.Run(url.origin()); | 495 return get_local_change_processor_.Run(url.origin()); |
496 DCHECK(local_change_processor_); | 496 DCHECK(local_change_processor_); |
497 return local_change_processor_; | 497 return local_change_processor_; |
498 } | 498 } |
499 | 499 |
500 } // namespace sync_file_system | 500 } // namespace sync_file_system |
OLD | NEW |