Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: chrome/browser/media_galleries/scoped_mtp_device_map_entry.h

Issue 14247034: Move Media Galleries FileAPI code out of webkit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cr-14352004
Patch Set: Add android ifdef. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // ScopedMTPDeviceMapEntry manages the lifetime of a MTPDeviceAsyncDelegate. 5 // ScopedMTPDeviceMapEntry manages the lifetime of a MTPDeviceAsyncDelegate.
6 // Each extension that uses a device holds a reference to the device's 6 // Each extension that uses a device holds a reference to the device's
7 // ScopedMTPDeviceMapEntry. 7 // ScopedMTPDeviceMapEntry.
8 8
9 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_SCOPED_MTP_DEVICE_MAP_ENTRY_H_ 9 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_SCOPED_MTP_DEVICE_MAP_ENTRY_H_
10 #define CHROME_BROWSER_MEDIA_GALLERIES_SCOPED_MTP_DEVICE_MAP_ENTRY_H_ 10 #define CHROME_BROWSER_MEDIA_GALLERIES_SCOPED_MTP_DEVICE_MAP_ENTRY_H_
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/sequenced_task_runner_helpers.h" 15 #include "base/sequenced_task_runner_helpers.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 17
18 namespace fileapi { 18 namespace chrome {
19
19 class MTPDeviceAsyncDelegate; 20 class MTPDeviceAsyncDelegate;
20 }
21
22 namespace chrome {
23 21
24 class ScopedMTPDeviceMapEntry 22 class ScopedMTPDeviceMapEntry
25 : public base::RefCountedThreadSafe< 23 : public base::RefCountedThreadSafe<
26 ScopedMTPDeviceMapEntry, content::BrowserThread::DeleteOnUIThread> { 24 ScopedMTPDeviceMapEntry, content::BrowserThread::DeleteOnUIThread> {
27 public: 25 public:
28 // |on_destruction_callback| is called when ScopedMTPDeviceMapEntry gets 26 // |on_destruction_callback| is called when ScopedMTPDeviceMapEntry gets
29 // destroyed. 27 // destroyed.
30 // Created on the UI thread. 28 // Created on the UI thread.
31 ScopedMTPDeviceMapEntry(const base::FilePath::StringType& device_location, 29 ScopedMTPDeviceMapEntry(const base::FilePath::StringType& device_location,
32 const base::Closure& on_destruction_callback); 30 const base::Closure& on_destruction_callback);
(...skipping 10 matching lines...) Expand all
43 // Private because this class is ref-counted. Destroyed when: 41 // Private because this class is ref-counted. Destroyed when:
44 // - no extension is using the device. 42 // - no extension is using the device.
45 // - no extension has permission to access to device. 43 // - no extension has permission to access to device.
46 // - the device is detached. 44 // - the device is detached.
47 // - the browser shuts down. 45 // - the browser shuts down.
48 // Destroyed on the UI thread. 46 // Destroyed on the UI thread.
49 ~ScopedMTPDeviceMapEntry(); 47 ~ScopedMTPDeviceMapEntry();
50 48
51 // Callback to add the managed MTPDeviceAsyncDelegate to the 49 // Callback to add the managed MTPDeviceAsyncDelegate to the
52 // MTPDeviceMapService on the IO thread. 50 // MTPDeviceMapService on the IO thread.
53 void OnMTPDeviceAsyncDelegateCreated( 51 void OnMTPDeviceAsyncDelegateCreated(MTPDeviceAsyncDelegate* delegate);
54 fileapi::MTPDeviceAsyncDelegate* delegate);
55 52
56 // The MTP or PTP device location. 53 // The MTP or PTP device location.
57 const base::FilePath::StringType device_location_; 54 const base::FilePath::StringType device_location_;
58 55
59 // Called when the object is destroyed. 56 // Called when the object is destroyed.
60 base::Closure on_destruction_callback_; 57 base::Closure on_destruction_callback_;
61 58
62 DISALLOW_COPY_AND_ASSIGN(ScopedMTPDeviceMapEntry); 59 DISALLOW_COPY_AND_ASSIGN(ScopedMTPDeviceMapEntry);
63 }; 60 };
64 61
65 } // namespace chrome 62 } // namespace chrome
66 63
67 #endif // CHROME_BROWSER_MEDIA_GALLERIES_SCOPED_MTP_DEVICE_MAP_ENTRY_H_ 64 #endif // CHROME_BROWSER_MEDIA_GALLERIES_SCOPED_MTP_DEVICE_MAP_ENTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698