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

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

Issue 10872076: Fix MediaStorageUtil::CrackDeviceId function to include ":" in the media device type prefix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 8 years, 3 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 // chrome::MediaStorageUtil implementation. 5 // chrome::MediaStorageUtil implementation.
6 6
7 #include "chrome/browser/media_gallery/media_storage_util.h" 7 #include "chrome/browser/media_gallery/media_storage_util.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 return std::string(kUsbMtpPrefix) + unique_id; 94 return std::string(kUsbMtpPrefix) + unique_id;
95 } 95 }
96 NOTREACHED(); 96 NOTREACHED();
97 return std::string(); 97 return std::string();
98 } 98 }
99 99
100 // static 100 // static
101 bool MediaStorageUtil::CrackDeviceId(const std::string& device_id, 101 bool MediaStorageUtil::CrackDeviceId(const std::string& device_id,
102 Type* type, std::string* unique_id) { 102 Type* type, std::string* unique_id) {
103 size_t prefix_length = device_id.find_first_of(':'); 103 size_t prefix_length = device_id.find_first_of(':');
104 std::string prefix = device_id.substr(0, prefix_length); 104 std::string prefix = prefix_length != std::string::npos ?
105 device_id.substr(0, prefix_length + 1) : "";
105 106
106 Type found_type; 107 Type found_type;
107 if (prefix == kUsbMassStorageWithDCIMPrefix) { 108 if (prefix == kUsbMassStorageWithDCIMPrefix) {
108 found_type = USB_MASS_STORAGE_WITH_DCIM; 109 found_type = USB_MASS_STORAGE_WITH_DCIM;
109 } else if (prefix == kUsbMassStorageNoDCIMPrefix) { 110 } else if (prefix == kUsbMassStorageNoDCIMPrefix) {
110 found_type = USB_MASS_STORAGE_NO_DCIM; 111 found_type = USB_MASS_STORAGE_NO_DCIM;
111 } else if (prefix == kOtherMassStoragePrefix) { 112 } else if (prefix == kOtherMassStoragePrefix) {
112 found_type = OTHER_MASS_STORAGE; 113 found_type = OTHER_MASS_STORAGE;
113 } else if (prefix == kUsbMtpPrefix) { 114 } else if (prefix == kUsbMtpPrefix) {
114 found_type = USB_MTP; 115 found_type = USB_MTP;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 void MediaStorageUtil::FindUSBDeviceById(const std::string& unique_id, 224 void MediaStorageUtil::FindUSBDeviceById(const std::string& unique_id,
224 const FilePathCallback& callback) { 225 const FilePathCallback& callback) {
225 // TODO(vandebo) This needs to be implemented per platform. 226 // TODO(vandebo) This needs to be implemented per platform.
226 // Type is USB_MASS_STORAGE_NO_DCIM, so it's a device possibly mounted 227 // Type is USB_MASS_STORAGE_NO_DCIM, so it's a device possibly mounted
227 // somewhere... 228 // somewhere...
228 NOTREACHED(); 229 NOTREACHED();
229 callback.Run(FilePath()); 230 callback.Run(FilePath());
230 } 231 }
231 232
232 } // namespace chrome 233 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698