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/chromeos/drive/file_system/open_file_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/open_file_operation.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
11 #include "base/task_runner_util.h" | 11 #include "base/task_runner_util.h" |
12 #include "chrome/browser/chromeos/drive/drive.pb.h" | 12 #include "chrome/browser/chromeos/drive/drive.pb.h" |
13 #include "chrome/browser/chromeos/drive/file_cache.h" | 13 #include "chrome/browser/chromeos/drive/file_cache.h" |
14 #include "chrome/browser/chromeos/drive/file_errors.h" | 14 #include "chrome/browser/chromeos/drive/file_errors.h" |
15 #include "chrome/browser/chromeos/drive/file_system/create_file_operation.h" | 15 #include "chrome/browser/chromeos/drive/file_system/create_file_operation.h" |
16 #include "chrome/browser/chromeos/drive/file_system/download_operation.h" | 16 #include "chrome/browser/chromeos/drive/file_system/download_operation.h" |
17 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 17 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 | 19 |
20 using content::BrowserThread; | 20 using content::BrowserThread; |
21 | 21 |
22 namespace drive { | 22 namespace drive { |
23 namespace file_system { | 23 namespace file_system { |
24 namespace { | 24 namespace { |
25 | 25 |
26 FileError UpdateFileLocalState(internal::FileCache* cache, | 26 FileError UpdateFileLocalState(internal::FileCache* cache, |
27 const std::string& resource_id, | 27 const std::string& resource_id, |
28 const std::string& md5, | 28 const std::string& md5, |
29 base::FilePath* local_file_path) { | 29 base::FilePath* local_file_path) { |
30 FileError error = cache->MarkDirty(resource_id, md5); | 30 FileError error = cache->MarkDirty(resource_id); |
31 if (error != FILE_ERROR_OK) | 31 if (error != FILE_ERROR_OK) |
32 return error; | 32 return error; |
33 | 33 |
34 return cache->GetFile(resource_id, md5, local_file_path); | 34 return cache->GetFile(resource_id, md5, local_file_path); |
35 } | 35 } |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 OpenFileOperation::OpenFileOperation( | 39 OpenFileOperation::OpenFileOperation( |
40 base::SequencedTaskRunner* blocking_task_runner, | 40 base::SequencedTaskRunner* blocking_task_runner, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
160 DCHECK(!callback.is_null()); | 160 DCHECK(!callback.is_null()); |
161 | 161 |
162 if (error == FILE_ERROR_OK) | 162 if (error == FILE_ERROR_OK) |
163 ++(*open_files_)[file_path]; | 163 ++(*open_files_)[file_path]; |
164 callback.Run(error, *local_file_path); | 164 callback.Run(error, *local_file_path); |
165 } | 165 } |
166 | 166 |
167 } // namespace file_system | 167 } // namespace file_system |
168 } // namespace drive | 168 } // namespace drive |
OLD | NEW |