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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 if (enabled) | 100 if (enabled) |
101 disabled_origins_.erase(origin); | 101 disabled_origins_.erase(origin); |
102 else | 102 else |
103 disabled_origins_.insert(origin); | 103 disabled_origins_.insert(origin); |
104 } | 104 } |
105 | 105 |
106 // LocalFileSyncService ------------------------------------------------------- | 106 // LocalFileSyncService ------------------------------------------------------- |
107 | 107 |
108 scoped_ptr<LocalFileSyncService> LocalFileSyncService::Create( | 108 scoped_ptr<LocalFileSyncService> LocalFileSyncService::Create( |
109 Profile* profile) { | 109 Profile* profile) { |
110 return make_scoped_ptr(new LocalFileSyncService(profile, NULL)); | 110 return make_scoped_ptr(new LocalFileSyncService(profile, nullptr)); |
111 } | 111 } |
112 | 112 |
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(BrowserThread::CurrentlyOn(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_ = NULL; | 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, |
134 storage::FileSystemContext* file_system_context, | 134 storage::FileSystemContext* file_system_context, |
135 const SyncStatusCallback& callback) { | 135 const SyncStatusCallback& callback) { |
136 sync_context_->MaybeInitializeFileSystemContext( | 136 sync_context_->MaybeInitializeFileSystemContext( |
137 app_origin, file_system_context, | 137 app_origin, file_system_context, |
138 base::Bind(&LocalFileSyncService::DidInitializeFileSystemContext, | 138 base::Bind(&LocalFileSyncService::DidInitializeFileSystemContext, |
139 AsWeakPtr(), app_origin, | 139 AsWeakPtr(), app_origin, |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 343 |
344 LocalFileSyncService::LocalFileSyncService(Profile* profile, | 344 LocalFileSyncService::LocalFileSyncService(Profile* profile, |
345 leveldb::Env* env_override) | 345 leveldb::Env* env_override) |
346 : profile_(profile), | 346 : profile_(profile), |
347 sync_context_(new LocalFileSyncContext( | 347 sync_context_(new LocalFileSyncContext( |
348 profile_->GetPath(), | 348 profile_->GetPath(), |
349 env_override, | 349 env_override, |
350 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI).get(), | 350 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI).get(), |
351 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO) | 351 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO) |
352 .get())), | 352 .get())), |
353 local_change_processor_(NULL) { | 353 local_change_processor_(nullptr) { |
354 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 354 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
355 sync_context_->AddOriginChangeObserver(this); | 355 sync_context_->AddOriginChangeObserver(this); |
356 } | 356 } |
357 | 357 |
358 void LocalFileSyncService::DidInitializeFileSystemContext( | 358 void LocalFileSyncService::DidInitializeFileSystemContext( |
359 const GURL& app_origin, | 359 const GURL& app_origin, |
360 storage::FileSystemContext* file_system_context, | 360 storage::FileSystemContext* file_system_context, |
361 const SyncStatusCallback& callback, | 361 const SyncStatusCallback& callback, |
362 SyncStatusCode status) { | 362 SyncStatusCode status) { |
363 if (status != SYNC_STATUS_OK) { | 363 if (status != SYNC_STATUS_OK) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 503 |
504 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor( | 504 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor( |
505 const FileSystemURL& url) { | 505 const FileSystemURL& url) { |
506 if (!get_local_change_processor_.is_null()) | 506 if (!get_local_change_processor_.is_null()) |
507 return get_local_change_processor_.Run(url.origin()); | 507 return get_local_change_processor_.Run(url.origin()); |
508 DCHECK(local_change_processor_); | 508 DCHECK(local_change_processor_); |
509 return local_change_processor_; | 509 return local_change_processor_; |
510 } | 510 } |
511 | 511 |
512 } // namespace sync_file_system | 512 } // namespace sync_file_system |
OLD | NEW |