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

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

Issue 12208079: Move TransientDeviceId from MediFileSystemRegistry to RemovableStorageNotifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments 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 implementation.
6
7 #include "chrome/browser/media_gallery/transient_device_ids.h"
8
9 #include "base/logging.h"
10 #include "chrome/browser/system_monitor/media_storage_util.h"
11
12 namespace chrome {
13
14 TransientDeviceIds::TransientDeviceIds() : next_transient_id_(1) {}
15
16 TransientDeviceIds::~TransientDeviceIds() {}
17
18 uint64 TransientDeviceIds::GetTransientIdForDeviceId(
19 const std::string& device_id) {
20 DCHECK(thread_checker_.CalledOnValidThread());
21 DCHECK(MediaStorageUtil::IsRemovableDevice(device_id));
22
23 bool inserted =
24 id_map_.insert(std::make_pair(device_id, next_transient_id_)).second;
25 if (inserted) {
26 // Inserted a device that has never been seen before.
27 ++next_transient_id_;
28 }
29 return id_map_[device_id];
30 }
31
32 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/media_gallery/transient_device_ids.h ('k') | chrome/browser/system_monitor/removable_storage_notifications.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698