| 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/browsing_data/browsing_data_file_system_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 14 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "webkit/browser/fileapi/file_system_context.h" | 16 #include "webkit/browser/fileapi/file_system_context.h" |
| 17 #include "webkit/browser/fileapi/file_system_quota_util.h" | 17 #include "webkit/browser/fileapi/file_system_quota_util.h" |
| 18 #include "webkit/browser/fileapi/file_system_task_runners.h" | |
| 19 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" | 18 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" |
| 20 #include "webkit/common/fileapi/file_system_types.h" | 19 #include "webkit/common/fileapi/file_system_types.h" |
| 21 | 20 |
| 22 using content::BrowserThread; | 21 using content::BrowserThread; |
| 23 | 22 |
| 24 namespace fileapi { | 23 namespace fileapi { |
| 25 class FileSystemContext; | 24 class FileSystemContext; |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace { | 27 namespace { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 50 // Triggers the success callback as the end of a StartFetching workflow. This | 49 // Triggers the success callback as the end of a StartFetching workflow. This |
| 51 // must be called on the UI thread. | 50 // must be called on the UI thread. |
| 52 void NotifyOnUIThread(); | 51 void NotifyOnUIThread(); |
| 53 | 52 |
| 54 // Deletes all file systems associated with |origin|. This must be called on | 53 // Deletes all file systems associated with |origin|. This must be called on |
| 55 // the file task runner. | 54 // the file task runner. |
| 56 void DeleteFileSystemOriginInFileThread(const GURL& origin); | 55 void DeleteFileSystemOriginInFileThread(const GURL& origin); |
| 57 | 56 |
| 58 // Returns the file task runner for the |filesystem_context_|. | 57 // Returns the file task runner for the |filesystem_context_|. |
| 59 base::SequencedTaskRunner* file_task_runner() { | 58 base::SequencedTaskRunner* file_task_runner() { |
| 60 return filesystem_context_->task_runners()->file_task_runner(); | 59 return filesystem_context_->default_file_task_runner(); |
| 61 } | 60 } |
| 62 | 61 |
| 63 // Keep a reference to the FileSystemContext object for the current profile | 62 // Keep a reference to the FileSystemContext object for the current profile |
| 64 // for use on the file task runner. | 63 // for use on the file task runner. |
| 65 scoped_refptr<fileapi::FileSystemContext> filesystem_context_; | 64 scoped_refptr<fileapi::FileSystemContext> filesystem_context_; |
| 66 | 65 |
| 67 // Holds the current list of file systems returned to the client after | 66 // Holds the current list of file systems returned to the client after |
| 68 // StartFetching is called. Access to |file_system_info_| is triggered | 67 // StartFetching is called. Access to |file_system_info_| is triggered |
| 69 // indirectly via the UI thread and guarded by |is_fetching_|. This means | 68 // indirectly via the UI thread and guarded by |is_fetching_|. This means |
| 70 // |file_system_info_| is only accessed while |is_fetching_| is true. The | 69 // |file_system_info_| is only accessed while |is_fetching_| is true. The |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 base::Bind(&CannedBrowsingDataFileSystemHelper::NotifyOnUIThread, this)); | 266 base::Bind(&CannedBrowsingDataFileSystemHelper::NotifyOnUIThread, this)); |
| 268 } | 267 } |
| 269 | 268 |
| 270 void CannedBrowsingDataFileSystemHelper::NotifyOnUIThread() { | 269 void CannedBrowsingDataFileSystemHelper::NotifyOnUIThread() { |
| 271 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 270 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 272 DCHECK(is_fetching_); | 271 DCHECK(is_fetching_); |
| 273 completion_callback_.Run(file_system_info_); | 272 completion_callback_.Run(file_system_info_); |
| 274 completion_callback_.Reset(); | 273 completion_callback_.Reset(); |
| 275 is_fetching_ = false; | 274 is_fetching_ = false; |
| 276 } | 275 } |
| OLD | NEW |