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/media_galleries/fileapi/file_path_watcher_util.h" | 5 #include "chrome/browser/media_galleries/fileapi/file_path_watcher_util.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 11 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 | 13 |
14 namespace chrome { | |
15 | |
16 namespace { | 14 namespace { |
17 | 15 |
18 // Bounces |path| and |error| to |callback| from the FILE thread to the media | 16 // Bounces |path| and |error| to |callback| from the FILE thread to the media |
19 // task runner. | 17 // task runner. |
20 void OnFilePathChangedOnFileThread( | 18 void OnFilePathChangedOnFileThread( |
21 const base::FilePathWatcher::Callback& callback, | 19 const base::FilePathWatcher::Callback& callback, |
22 const base::FilePath& path, | 20 const base::FilePath& path, |
23 bool error) { | 21 bool error) { |
24 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 22 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
25 MediaFileSystemBackend::MediaTaskRunner()->PostTask( | 23 MediaFileSystemBackend::MediaTaskRunner()->PostTask( |
(...skipping 27 matching lines...) Expand all Loading... |
53 const FileWatchStartedCallback& watch_started_callback, | 51 const FileWatchStartedCallback& watch_started_callback, |
54 const base::FilePathWatcher::Callback& path_changed_callback) { | 52 const base::FilePathWatcher::Callback& path_changed_callback) { |
55 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); | 53 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); |
56 content::BrowserThread::PostTask(content::BrowserThread::FILE, | 54 content::BrowserThread::PostTask(content::BrowserThread::FILE, |
57 FROM_HERE, | 55 FROM_HERE, |
58 base::Bind(&StartFilePathWatchOnFileThread, | 56 base::Bind(&StartFilePathWatchOnFileThread, |
59 path, | 57 path, |
60 watch_started_callback, | 58 watch_started_callback, |
61 path_changed_callback)); | 59 path_changed_callback)); |
62 } | 60 } |
63 | |
64 } // namespace chrome | |
OLD | NEW |