| 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/root_delete_helper.h" | 5 #include "chrome/browser/sync_file_system/local/root_delete_helper.h" |
| 6 | 6 |
| 7 #include "base/sequenced_task_runner.h" | 7 #include "base/sequenced_task_runner.h" |
| 8 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" | 8 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
| 9 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" | 9 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" |
| 10 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 10 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 util::Log(logging::LOG_INFO, FROM_HERE, | 59 util::Log(logging::LOG_INFO, FROM_HERE, |
| 60 "Deleting the entire local filesystem for remote root deletion: " | 60 "Deleting the entire local filesystem for remote root deletion: " |
| 61 "%s", url_.DebugString().c_str()); | 61 "%s", url_.DebugString().c_str()); |
| 62 | 62 |
| 63 file_system_context_->DeleteFileSystem( | 63 file_system_context_->DeleteFileSystem( |
| 64 url_.origin(), url_.type(), | 64 url_.origin(), url_.type(), |
| 65 base::Bind(&RootDeleteHelper::DidDeleteFileSystem, | 65 base::Bind(&RootDeleteHelper::DidDeleteFileSystem, |
| 66 weak_factory_.GetWeakPtr())); | 66 weak_factory_.GetWeakPtr())); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void RootDeleteHelper::DidDeleteFileSystem(base::PlatformFileError error) { | 69 void RootDeleteHelper::DidDeleteFileSystem(base::File::Error error) { |
| 70 // Ignore errors, no idea how to deal with it. | 70 // Ignore errors, no idea how to deal with it. |
| 71 | 71 |
| 72 DCHECK(!sync_status_->IsWritable(url_)); | 72 DCHECK(!sync_status_->IsWritable(url_)); |
| 73 DCHECK(!sync_status_->IsWriting(url_)); | 73 DCHECK(!sync_status_->IsWriting(url_)); |
| 74 | 74 |
| 75 // All writes to the entire file system must be now blocked, so we have | 75 // All writes to the entire file system must be now blocked, so we have |
| 76 // to be able to safely reset the local changes and sync statuses for it. | 76 // to be able to safely reset the local changes and sync statuses for it. |
| 77 // TODO(kinuko): This should be probably automatically handled in | 77 // TODO(kinuko): This should be probably automatically handled in |
| 78 // DeleteFileSystem via QuotaUtil::DeleteOriginDataOnFileThread. | 78 // DeleteFileSystem via QuotaUtil::DeleteOriginDataOnFileThread. |
| 79 file_system_context_->default_file_task_runner()->PostTaskAndReply( | 79 file_system_context_->default_file_task_runner()->PostTaskAndReply( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 90 // Reopening the filesystem. | 90 // Reopening the filesystem. |
| 91 file_system_context_->sandbox_delegate()->OpenFileSystem( | 91 file_system_context_->sandbox_delegate()->OpenFileSystem( |
| 92 url_.origin(), url_.type(), | 92 url_.origin(), url_.type(), |
| 93 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 93 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
| 94 base::Bind(&RootDeleteHelper::DidOpenFileSystem, | 94 base::Bind(&RootDeleteHelper::DidOpenFileSystem, |
| 95 weak_factory_.GetWeakPtr()), GURL()); | 95 weak_factory_.GetWeakPtr()), GURL()); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void RootDeleteHelper::DidOpenFileSystem(const GURL& /* root */, | 98 void RootDeleteHelper::DidOpenFileSystem(const GURL& /* root */, |
| 99 const std::string& /* name */, | 99 const std::string& /* name */, |
| 100 base::PlatformFileError error) { | 100 base::File::Error error) { |
| 101 FileStatusCallback callback = callback_; | 101 FileStatusCallback callback = callback_; |
| 102 callback.Run(error); | 102 callback.Run(error); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace sync_file_system | 105 } // namespace sync_file_system |
| OLD | NEW |