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

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

Issue 11648027: Extract external file systems handling from isolated context. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: few nits Created 7 years, 11 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/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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 task.get())); 121 task.get()));
122 } 122 }
123 123
124 void DeviceAttachedIntentSource::DispatchIntentsForService( 124 void DeviceAttachedIntentSource::DispatchIntentsForService(
125 const base::SystemMonitor::RemovableStorageInfo& device_info) { 125 const base::SystemMonitor::RemovableStorageInfo& device_info) {
126 // Store the media device info locally. 126 // Store the media device info locally.
127 device_id_map_.insert(std::make_pair(device_info.device_id, device_info)); 127 device_id_map_.insert(std::make_pair(device_info.device_id, device_info));
128 128
129 std::string device_name(UTF16ToUTF8(device_info.name)); 129 std::string device_name(UTF16ToUTF8(device_info.name));
130 const FilePath device_path(device_info.location); 130 const FilePath device_path(device_info.location);
131
kinuko 2013/01/10 05:47:31 nit: let's not make nop changes in the files you'r
tonibarzic 2013/01/11 01:50:04 Done.
132 // TODO(kinuko, kmadhusu): Use a different file system type for MTP. 131 // TODO(kinuko, kmadhusu): Use a different file system type for MTP.
133 // TODO(kmadhusu): To manage the registered file systems efficiently, register 132 // TODO(kmadhusu): To manage the registered file systems efficiently, register
134 // the attached device media file system using MediaFileSystemRegistry. 133 // the attached device media file system using MediaFileSystemRegistry.
135 const std::string fs_id = fileapi::IsolatedContext::GetInstance()-> 134 const std::string fs_id = fileapi::IsolatedContext::GetInstance()->
136 RegisterFileSystemForPath(fileapi::kFileSystemTypeNativeMedia, 135 RegisterFileSystemForPath(fileapi::kFileSystemTypeNativeMedia,
137 device_path, &device_name); 136 device_path, &device_name);
138 137
139 DCHECK(!fs_id.empty()); 138 DCHECK(!fs_id.empty());
140 webkit_glue::WebIntentData intent( 139 webkit_glue::WebIntentData intent(
141 UTF8ToUTF16(kAction), UTF8ToUTF16(kIntentType), device_name, fs_id); 140 UTF8ToUTF16(kAction), UTF8ToUTF16(kIntentType), device_name, fs_id);
142 141
143 delegate_->WebIntentDispatch(NULL /* no WebContents */, 142 delegate_->WebIntentDispatch(NULL /* no WebContents */,
144 content::WebIntentsDispatcher::Create(intent)); 143 content::WebIntentsDispatcher::Create(intent));
145 } 144 }
146 145
147 void DeviceAttachedIntentSource::OnRemovableStorageDetached( 146 void DeviceAttachedIntentSource::OnRemovableStorageDetached(
148 const std::string& id) { 147 const std::string& id) {
149 DeviceIdToInfoMap::iterator it = device_id_map_.find(id); 148 DeviceIdToInfoMap::iterator it = device_id_map_.find(id);
150 if (it == device_id_map_.end()) 149 if (it == device_id_map_.end())
151 return; 150 return;
152 151
153 FilePath path(it->second.location); 152 FilePath path(it->second.location);
154 fileapi::IsolatedContext::GetInstance()->RevokeFileSystemByPath(path); 153 fileapi::IsolatedContext::GetInstance()->RevokeFileSystemByPath(path);
155 device_id_map_.erase(it); 154 device_id_map_.erase(it);
156 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698