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

Side by Side Diff: chrome/browser/storage_monitor/storage_monitor_mac.mm

Issue 120983002: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 #include "chrome/browser/storage_monitor/storage_monitor_mac.h" 5 #include "chrome/browser/storage_monitor/storage_monitor_mac.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 CFUUIDCreateString(NULL, uuid)); 78 CFUUIDCreateString(NULL, uuid));
79 if (uuid_string.get()) 79 if (uuid_string.get())
80 unique_id = base::SysCFStringRefToUTF8(uuid_string); 80 unique_id = base::SysCFStringRefToUTF8(uuid_string);
81 } 81 }
82 if (unique_id.empty()) { 82 if (unique_id.empty()) {
83 base::string16 revision = GetUTF16FromDictionary( 83 base::string16 revision = GetUTF16FromDictionary(
84 dict, kDADiskDescriptionDeviceRevisionKey); 84 dict, kDADiskDescriptionDeviceRevisionKey);
85 base::string16 unique_id2 = vendor; 85 base::string16 unique_id2 = vendor;
86 unique_id2 = JoinName(unique_id2, model); 86 unique_id2 = JoinName(unique_id2, model);
87 unique_id2 = JoinName(unique_id2, revision); 87 unique_id2 = JoinName(unique_id2, revision);
88 unique_id = UTF16ToUTF8(unique_id2); 88 unique_id = base::UTF16ToUTF8(unique_id2);
89 } 89 }
90 90
91 CFBooleanRef is_removable_ref = 91 CFBooleanRef is_removable_ref =
92 base::mac::GetValueFromDictionary<CFBooleanRef>( 92 base::mac::GetValueFromDictionary<CFBooleanRef>(
93 dict, kDADiskDescriptionMediaRemovableKey); 93 dict, kDADiskDescriptionMediaRemovableKey);
94 bool is_removable = is_removable_ref && CFBooleanGetValue(is_removable_ref); 94 bool is_removable = is_removable_ref && CFBooleanGetValue(is_removable_ref);
95 // Checking for DCIM only matters on removable devices. 95 // Checking for DCIM only matters on removable devices.
96 bool has_dcim = is_removable && MediaStorageUtil::HasDcim(location); 96 bool has_dcim = is_removable && MediaStorageUtil::HasDcim(location);
97 StorageInfo::Type device_type = GetDeviceType(is_removable, has_dcim); 97 StorageInfo::Type device_type = GetDeviceType(is_removable, has_dcim);
98 std::string device_id; 98 std::string device_id;
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 AsWeakPtr(), dict, update_type)); 358 AsWeakPtr(), dict, update_type));
359 } 359 }
360 360
361 361
362 bool StorageMonitorMac::ShouldPostNotificationForDisk( 362 bool StorageMonitorMac::ShouldPostNotificationForDisk(
363 const StorageInfo& info) const { 363 const StorageInfo& info) const {
364 // Only post notifications about disks that have no empty fields and 364 // Only post notifications about disks that have no empty fields and
365 // are removable. Also exclude disk images (DMGs). 365 // are removable. Also exclude disk images (DMGs).
366 return !info.device_id().empty() && 366 return !info.device_id().empty() &&
367 !info.location().empty() && 367 !info.location().empty() &&
368 info.model_name() != ASCIIToUTF16(kDiskImageModelName) && 368 info.model_name() != base::ASCIIToUTF16(kDiskImageModelName) &&
369 StorageInfo::IsMassStorageDevice(info.device_id()); 369 StorageInfo::IsMassStorageDevice(info.device_id());
370 } 370 }
371 371
372 bool StorageMonitorMac::FindDiskWithMountPoint( 372 bool StorageMonitorMac::FindDiskWithMountPoint(
373 const base::FilePath& mount_point, 373 const base::FilePath& mount_point,
374 StorageInfo* info) const { 374 StorageInfo* info) const {
375 for (std::map<std::string, StorageInfo>::const_iterator 375 for (std::map<std::string, StorageInfo>::const_iterator
376 it = disk_info_map_.begin(); it != disk_info_map_.end(); ++it) { 376 it = disk_info_map_.begin(); it != disk_info_map_.end(); ++it) {
377 if (it->second.location() == mount_point.value()) { 377 if (it->second.location() == mount_point.value()) {
378 *info = it->second; 378 *info = it->second;
379 return true; 379 return true;
380 } 380 }
381 } 381 }
382 return false; 382 return false;
383 } 383 }
384 384
385 StorageMonitor* StorageMonitor::Create() { 385 StorageMonitor* StorageMonitor::Create() {
386 return new StorageMonitorMac(); 386 return new StorageMonitorMac();
387 } 387 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698