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

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

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

Powered by Google App Engine
This is Rietveld 408576698