OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/local_discovery/storage/privet_filesystem_operations.h" | 5 #include "chrome/browser/local_discovery/storage/privet_filesystem_operations.h" |
6 | 6 |
7 #include "chrome/browser/local_discovery/storage/privet_filesystem_constants.h" | 7 #include "chrome/browser/local_discovery/storage/privet_filesystem_constants.h" |
8 | 8 |
9 namespace local_discovery { | 9 namespace local_discovery { |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 base::Bind(&PrivetFileSystemListOperation::OnStorageListResult, | 142 base::Bind(&PrivetFileSystemListOperation::OnStorageListResult, |
143 base::Unretained(this))); | 143 base::Unretained(this))); |
144 list_operation_->Start(); | 144 list_operation_->Start(); |
145 } | 145 } |
146 | 146 |
147 void PrivetFileSystemListOperation::OnStorageListResult( | 147 void PrivetFileSystemListOperation::OnStorageListResult( |
148 const base::DictionaryValue* value) { | 148 const base::DictionaryValue* value) { |
149 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 149 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
150 list_operation_.reset(); | 150 list_operation_.reset(); |
151 | 151 |
152 attribute_cache_->AddFileInfoFromJSON(full_path_, value); | |
153 | |
154 fileapi::AsyncFileUtil::EntryList entry_list; | |
155 | |
156 if (!value) { | 152 if (!value) { |
157 SignalError(); | 153 SignalError(); |
158 return; | 154 return; |
159 } | 155 } |
160 | 156 |
| 157 attribute_cache_->AddFileInfoFromJSON(full_path_, value); |
| 158 |
| 159 fileapi::AsyncFileUtil::EntryList entry_list; |
| 160 |
161 const base::ListValue* entries; | 161 const base::ListValue* entries; |
162 if (!value->GetList(kPrivetListEntries, &entries)) { | 162 if (!value->GetList(kPrivetListEntries, &entries)) { |
163 SignalError(); | 163 SignalError(); |
164 return; | 164 return; |
165 } | 165 } |
166 | 166 |
167 for (size_t i = 0; i < entries->GetSize(); i++) { | 167 for (size_t i = 0; i < entries->GetSize(); i++) { |
168 const base::DictionaryValue* entry_value; | 168 const base::DictionaryValue* entry_value; |
169 if (!entries->GetDictionary(i, &entry_value)) { | 169 if (!entries->GetDictionary(i, &entry_value)) { |
170 SignalError(); | 170 SignalError(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 base::File::Error result, | 280 base::File::Error result, |
281 const base::File::Info& info) { | 281 const base::File::Info& info) { |
282 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 282 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
283 content::BrowserThread::PostTask(content::BrowserThread::IO, | 283 content::BrowserThread::PostTask(content::BrowserThread::IO, |
284 FROM_HERE, | 284 FROM_HERE, |
285 base::Bind(callback_, result, info)); | 285 base::Bind(callback_, result, info)); |
286 container_->RemoveOperation(this); | 286 container_->RemoveOperation(this); |
287 } | 287 } |
288 | 288 |
289 } // namespace local_discovery | 289 } // namespace local_discovery |
OLD | NEW |