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

Side by Side Diff: chrome/browser/media_gallery/transient_device_ids.h

Issue 12208079: Move TransientDeviceId from MediFileSystemRegistry to RemovableStorageNotifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Abstract a bit better Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // TransientDeviceIds keep track of transient IDs for removable devices, so
6 // persistent device IDs are not exposed to renderers. Once a removable device
7 // gets mapped to a transient ID, the mapping remains valid for the duration of
8 // TransientDeviceIds' lifetime.
9
10 #ifndef CHROME_BROWSER_MEDIA_GALLERY_TRANSIENT_DEVICE_IDS_H_
11 #define CHROME_BROWSER_MEDIA_GALLERY_TRANSIENT_DEVICE_IDS_H_
12
13 #include <map>
14 #include <string>
15
16 #include "base/basictypes.h"
17 #include "base/threading/thread_checker.h"
18
19 namespace chrome {
20
21 class TransientDeviceIds {
22 public:
23 TransientDeviceIds();
24 ~TransientDeviceIds();
25
26 // Returns the transient ID for a given |device_id|.
27 // |device_id| must be for a removable device.
28 // If |device_id| has never been seen before, a new, unique transient id will
29 // be assigned.
30 uint64 GetTransientIdForDeviceId(const std::string& device_id);
31
32 private:
33 typedef std::map<std::string, uint64> DeviceIdToTransientIdMap;
34
35 DeviceIdToTransientIdMap id_map_;
36 uint64 next_transient_id_;
37
38 base::ThreadChecker thread_checker_;
39
40 DISALLOW_COPY_AND_ASSIGN(TransientDeviceIds);
41 };
42
43 } // namespace chrome
44
45 #endif // CHROME_BROWSER_MEDIA_GALLERY_TRANSIENT_DEVICE_IDS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698