| 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/memory/ptr_util.h" |
| 7 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 8 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 9 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" | 11 #include "chrome/browser/extensions/extension_util.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/sync_file_system/file_change.h" | 13 #include "chrome/browser/sync_file_system/file_change.h" |
| 13 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" | 14 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
| 14 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 15 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
| 15 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 16 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
| 16 #include "chrome/browser/sync_file_system/local_change_processor.h" | 17 #include "chrome/browser/sync_file_system/local_change_processor.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void LocalFileSyncService::OriginChangeMap::SetOriginEnabled( | 100 void LocalFileSyncService::OriginChangeMap::SetOriginEnabled( |
| 100 const GURL& origin, bool enabled) { | 101 const GURL& origin, bool enabled) { |
| 101 if (enabled) | 102 if (enabled) |
| 102 disabled_origins_.erase(origin); | 103 disabled_origins_.erase(origin); |
| 103 else | 104 else |
| 104 disabled_origins_.insert(origin); | 105 disabled_origins_.insert(origin); |
| 105 } | 106 } |
| 106 | 107 |
| 107 // LocalFileSyncService ------------------------------------------------------- | 108 // LocalFileSyncService ------------------------------------------------------- |
| 108 | 109 |
| 109 scoped_ptr<LocalFileSyncService> LocalFileSyncService::Create( | 110 std::unique_ptr<LocalFileSyncService> LocalFileSyncService::Create( |
| 110 Profile* profile) { | 111 Profile* profile) { |
| 111 return make_scoped_ptr(new LocalFileSyncService(profile, nullptr)); | 112 return base::WrapUnique(new LocalFileSyncService(profile, nullptr)); |
| 112 } | 113 } |
| 113 | 114 |
| 114 scoped_ptr<LocalFileSyncService> LocalFileSyncService::CreateForTesting( | 115 std::unique_ptr<LocalFileSyncService> LocalFileSyncService::CreateForTesting( |
| 115 Profile* profile, | 116 Profile* profile, |
| 116 leveldb::Env* env) { | 117 leveldb::Env* env) { |
| 117 scoped_ptr<LocalFileSyncService> sync_service( | 118 std::unique_ptr<LocalFileSyncService> sync_service( |
| 118 new LocalFileSyncService(profile, env)); | 119 new LocalFileSyncService(profile, env)); |
| 119 sync_service->sync_context_->set_mock_notify_changes_duration_in_sec(0); | 120 sync_service->sync_context_->set_mock_notify_changes_duration_in_sec(0); |
| 120 return sync_service; | 121 return sync_service; |
| 121 } | 122 } |
| 122 | 123 |
| 123 LocalFileSyncService::~LocalFileSyncService() { | 124 LocalFileSyncService::~LocalFileSyncService() { |
| 124 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 125 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 125 } | 126 } |
| 126 | 127 |
| 127 void LocalFileSyncService::Shutdown() { | 128 void LocalFileSyncService::Shutdown() { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 490 |
| 490 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor( | 491 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor( |
| 491 const FileSystemURL& url) { | 492 const FileSystemURL& url) { |
| 492 if (!get_local_change_processor_.is_null()) | 493 if (!get_local_change_processor_.is_null()) |
| 493 return get_local_change_processor_.Run(url.origin()); | 494 return get_local_change_processor_.Run(url.origin()); |
| 494 DCHECK(local_change_processor_); | 495 DCHECK(local_change_processor_); |
| 495 return local_change_processor_; | 496 return local_change_processor_; |
| 496 } | 497 } |
| 497 | 498 |
| 498 } // namespace sync_file_system | 499 } // namespace sync_file_system |
| OLD | NEW |