OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/drive/file_system/remove_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" |
6 | 6 |
7 #include "base/sequenced_task_runner.h" | 7 #include "base/sequenced_task_runner.h" |
8 #include "chrome/browser/chromeos/drive/drive.pb.h" | 8 #include "chrome/browser/chromeos/drive/drive.pb.h" |
9 #include "chrome/browser/chromeos/drive/file_cache.h" | 9 #include "chrome/browser/chromeos/drive/file_cache.h" |
10 #include "chrome/browser/chromeos/drive/file_change.h" | 10 #include "chrome/browser/chromeos/drive/file_change.h" |
11 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 11 #include "chrome/browser/chromeos/drive/file_system/operation_delegate.h" |
12 #include "chrome/browser/chromeos/drive/file_system_util.h" | 12 #include "chrome/browser/chromeos/drive/file_system_util.h" |
13 #include "chrome/browser/chromeos/drive/resource_metadata.h" | 13 #include "chrome/browser/chromeos/drive/resource_metadata.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 | 15 |
16 using content::BrowserThread; | 16 using content::BrowserThread; |
17 | 17 |
18 namespace drive { | 18 namespace drive { |
19 namespace file_system { | 19 namespace file_system { |
20 | 20 |
21 namespace { | 21 namespace { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // Move to the trash. | 55 // Move to the trash. |
56 entry->set_parent_local_id(util::kDriveTrashDirLocalId); | 56 entry->set_parent_local_id(util::kDriveTrashDirLocalId); |
57 return metadata->RefreshEntry(*entry); | 57 return metadata->RefreshEntry(*entry); |
58 } | 58 } |
59 | 59 |
60 } // namespace | 60 } // namespace |
61 | 61 |
62 RemoveOperation::RemoveOperation( | 62 RemoveOperation::RemoveOperation( |
63 base::SequencedTaskRunner* blocking_task_runner, | 63 base::SequencedTaskRunner* blocking_task_runner, |
64 OperationObserver* observer, | 64 OperationDelegate* delegate, |
65 internal::ResourceMetadata* metadata, | 65 internal::ResourceMetadata* metadata, |
66 internal::FileCache* cache) | 66 internal::FileCache* cache) |
67 : blocking_task_runner_(blocking_task_runner), | 67 : blocking_task_runner_(blocking_task_runner), |
68 observer_(observer), | 68 delegate_(delegate), |
69 metadata_(metadata), | 69 metadata_(metadata), |
70 cache_(cache), | 70 cache_(cache), |
71 weak_ptr_factory_(this) { | 71 weak_ptr_factory_(this) { |
72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
73 } | 73 } |
74 | 74 |
75 RemoveOperation::~RemoveOperation() { | 75 RemoveOperation::~RemoveOperation() { |
76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
77 } | 77 } |
78 | 78 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 const ResourceEntry* entry, | 110 const ResourceEntry* entry, |
111 const base::FilePath* changed_path, | 111 const base::FilePath* changed_path, |
112 FileError error) { | 112 FileError error) { |
113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
114 DCHECK(!callback.is_null()); | 114 DCHECK(!callback.is_null()); |
115 | 115 |
116 if (!changed_path->empty()) { | 116 if (!changed_path->empty()) { |
117 FileChange changed_file; | 117 FileChange changed_file; |
118 changed_file.Update(*changed_path, *entry, FileChange::DELETE); | 118 changed_file.Update(*changed_path, *entry, FileChange::DELETE); |
119 if (error == FILE_ERROR_OK) { | 119 if (error == FILE_ERROR_OK) { |
120 observer_->OnFileChangedByOperation(changed_file); | 120 delegate_->OnFileChangedByOperation(changed_file); |
121 observer_->OnEntryUpdatedByOperation(*local_id); | 121 delegate_->OnEntryUpdatedByOperation(*local_id); |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 callback.Run(error); | 125 callback.Run(error); |
126 } | 126 } |
127 | 127 |
128 } // namespace file_system | 128 } // namespace file_system |
129 } // namespace drive | 129 } // namespace drive |
OLD | NEW |