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

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

Issue 10713007: Make isolated file system works for a device root (e.g. X:\\) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 5 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 "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 void DeviceAttachedIntentSource::OnMediaDeviceAttached( 33 void DeviceAttachedIntentSource::OnMediaDeviceAttached(
34 const base::SystemMonitor::DeviceIdType& id, 34 const base::SystemMonitor::DeviceIdType& id,
35 const std::string& name, 35 const std::string& name,
36 const FilePath& device_path) { 36 const FilePath& device_path) {
37 if (!browser_->window()->IsActive()) 37 if (!browser_->window()->IsActive())
38 return; 38 return;
39 39
40 // Sanity checks for |device_path|. 40 // Sanity checks for |device_path|.
41 if (!device_path.IsAbsolute() || device_path.ReferencesParent() || 41 if (!device_path.IsAbsolute() || device_path.ReferencesParent()) {
42 device_path.BaseName().IsAbsolute() || device_path.BaseName().empty()) {
43 return; 42 return;
44 } 43 }
45 44
45 std::string device_name;
46
46 // Register device path as an isolated file system. 47 // Register device path as an isolated file system.
47 std::set<FilePath> fileset;
48 fileset.insert(device_path);
49 const std::string filesystem_id = 48 const std::string filesystem_id =
50 fileapi::IsolatedContext::GetInstance()-> 49 fileapi::IsolatedContext::GetInstance()->RegisterFileSystemForFile(
51 RegisterIsolatedFileSystem(fileset); 50 device_path, &device_name);
51
52 CHECK(!filesystem_id.empty()); 52 CHECK(!filesystem_id.empty());
53 webkit_glue::WebIntentData intent( 53 webkit_glue::WebIntentData intent(
54 ASCIIToUTF16("chrome-extension://attach"), 54 ASCIIToUTF16("chrome-extension://attach"),
55 ASCIIToUTF16("chrome-extension://filesystem"), 55 ASCIIToUTF16("chrome-extension://filesystem"),
56 device_path, 56 device_name,
57 filesystem_id); 57 filesystem_id);
58 58
59 content::WebIntentsDispatcher* dispatcher = 59 content::WebIntentsDispatcher* dispatcher =
60 content::WebIntentsDispatcher::Create(intent); 60 content::WebIntentsDispatcher::Create(intent);
61 delegate_->WebIntentDispatch(NULL, dispatcher); 61 delegate_->WebIntentDispatch(NULL, dispatcher);
62 } 62 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/platform_app_launcher.cc ('k') | chrome/browser/media_gallery/media_file_system_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698