OLD | NEW |
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/intents/device_attached_intent_source.h" | 5 #include "chrome/browser/intents/device_attached_intent_source.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 return; | 104 return; |
105 | 105 |
106 // TODO(kmadhusu): Dispatch intents on incognito window. | 106 // TODO(kmadhusu): Dispatch intents on incognito window. |
107 if (browser_->profile()->IsOffTheRecord()) | 107 if (browser_->profile()->IsOffTheRecord()) |
108 return; | 108 return; |
109 | 109 |
110 // Only handle mass storage for now. | 110 // Only handle mass storage for now. |
111 // TODO(kmadhusu): Handle all device types. http://crbug.com/140353. | 111 // TODO(kmadhusu): Handle all device types. http://crbug.com/140353. |
112 MediaStorageUtil::Type type; | 112 MediaStorageUtil::Type type; |
113 MediaStorageUtil::CrackDeviceId(id, &type, NULL); | 113 MediaStorageUtil::CrackDeviceId(id, &type, NULL); |
114 if (type == MediaStorageUtil::USB_MTP) | 114 if (type == MediaStorageUtil::MTP_OR_PTP) |
115 return; | 115 return; |
116 DCHECK(MediaStorageUtil::IsRemovableDevice(id)); | 116 DCHECK(MediaStorageUtil::IsRemovableDevice(id)); |
117 | 117 |
118 // Sanity checks for |device_path|. | 118 // Sanity checks for |device_path|. |
119 const FilePath device_path(location); | 119 const FilePath device_path(location); |
120 if (!device_path.IsAbsolute() || device_path.ReferencesParent()) | 120 if (!device_path.IsAbsolute() || device_path.ReferencesParent()) |
121 return; | 121 return; |
122 | 122 |
123 SystemMonitor::RemovableStorageInfo device_info(id, name, location); | 123 SystemMonitor::RemovableStorageInfo device_info(id, name, location); |
124 scoped_refptr<DispatchIntentTaskHelper> task = new DispatchIntentTaskHelper( | 124 scoped_refptr<DispatchIntentTaskHelper> task = new DispatchIntentTaskHelper( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 // TODO(kmadhusu) This should be something like | 160 // TODO(kmadhusu) This should be something like |
161 // RevokeFileSystemByDevice(std::string) | 161 // RevokeFileSystemByDevice(std::string) |
162 FilePath path(it->second.location); | 162 FilePath path(it->second.location); |
163 fileapi::IsolatedContext::GetInstance()->RevokeFileSystemByPath(path); | 163 fileapi::IsolatedContext::GetInstance()->RevokeFileSystemByPath(path); |
164 | 164 |
165 #if defined(SUPPORT_MEDIA_FILESYSTEM) | 165 #if defined(SUPPORT_MEDIA_FILESYSTEM) |
166 // TODO(kmadhusu, vandebo): Clean up this code. http://crbug.com/140340. | 166 // TODO(kmadhusu, vandebo): Clean up this code. http://crbug.com/140340. |
167 MediaStorageUtil::Type type; | 167 MediaStorageUtil::Type type; |
168 MediaStorageUtil::CrackDeviceId(it->second.device_id, &type, NULL); | 168 MediaStorageUtil::CrackDeviceId(it->second.device_id, &type, NULL); |
169 if (type == MediaStorageUtil::USB_MTP) { | 169 if (type == MediaStorageUtil::MTP_OR_PTP) { |
170 MediaDeviceMapService::GetInstance()->RemoveMediaDevice( | 170 MediaDeviceMapService::GetInstance()->RemoveMediaDevice( |
171 it->second.location); | 171 it->second.location); |
172 } | 172 } |
173 #endif | 173 #endif |
174 device_id_map_.erase(it); | 174 device_id_map_.erase(it); |
175 } | 175 } |
OLD | NEW |