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

Side by Side Diff: chrome/browser/intents/device_attached_intent_source.cc

Issue 10876093: Improve the device type constants. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
« no previous file with comments | « no previous file | chrome/browser/media_gallery/media_device_notifications_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return; 97 return;
98 98
99 // TODO(kmadhusu): Dispatch intents on incognito window. 99 // TODO(kmadhusu): Dispatch intents on incognito window.
100 if (browser_->profile()->IsOffTheRecord()) 100 if (browser_->profile()->IsOffTheRecord())
101 return; 101 return;
102 102
103 // Only handle mass storage for now. 103 // Only handle mass storage for now.
104 // TODO(kmadhusu): Handle all device types. http://crbug.com/140353. 104 // TODO(kmadhusu): Handle all device types. http://crbug.com/140353.
105 MediaStorageUtil::Type type; 105 MediaStorageUtil::Type type;
106 MediaStorageUtil::CrackDeviceId(id, &type, NULL); 106 MediaStorageUtil::CrackDeviceId(id, &type, NULL);
107 if (type == MediaStorageUtil::USB_MTP) 107 if (type == MediaStorageUtil::MTP_OR_PTP)
108 return; 108 return;
109 DCHECK(MediaStorageUtil::IsRemovableDevice(id)); 109 DCHECK(MediaStorageUtil::IsRemovableDevice(id));
110 110
111 // Sanity checks for |device_path|. 111 // Sanity checks for |device_path|.
112 const FilePath device_path(location); 112 const FilePath device_path(location);
113 if (!device_path.IsAbsolute() || device_path.ReferencesParent()) 113 if (!device_path.IsAbsolute() || device_path.ReferencesParent())
114 return; 114 return;
115 115
116 SystemMonitor::RemovableStorageInfo device_info(id, name, location); 116 SystemMonitor::RemovableStorageInfo device_info(id, name, location);
117 scoped_refptr<DispatchIntentTaskHelper> task = new DispatchIntentTaskHelper( 117 scoped_refptr<DispatchIntentTaskHelper> task = new DispatchIntentTaskHelper(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void DeviceAttachedIntentSource::OnRemovableStorageDetached( 149 void DeviceAttachedIntentSource::OnRemovableStorageDetached(
150 const std::string& id) { 150 const std::string& id) {
151 DeviceIdToInfoMap::iterator it = device_id_map_.find(id); 151 DeviceIdToInfoMap::iterator it = device_id_map_.find(id);
152 if (it == device_id_map_.end()) 152 if (it == device_id_map_.end())
153 return; 153 return;
154 154
155 FilePath path(it->second.location); 155 FilePath path(it->second.location);
156 fileapi::IsolatedContext::GetInstance()->RevokeFileSystemByPath(path); 156 fileapi::IsolatedContext::GetInstance()->RevokeFileSystemByPath(path);
157 device_id_map_.erase(it); 157 device_id_map_.erase(it);
158 } 158 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media_gallery/media_device_notifications_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698