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 <string> |
| 8 |
7 #include "base/file_path.h" | 9 #include "base/file_path.h" |
8 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
11 #include "content/public/browser/web_intents_dispatcher.h" | 13 #include "content/public/browser/web_intents_dispatcher.h" |
12 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
13 #include "webkit/fileapi/file_system_types.h" | 15 #include "webkit/fileapi/file_system_types.h" |
14 #include "webkit/fileapi/isolated_context.h" | 16 #include "webkit/fileapi/isolated_context.h" |
15 #include "webkit/glue/web_intent_data.h" | 17 #include "webkit/glue/web_intent_data.h" |
16 | 18 |
(...skipping 30 matching lines...) Expand all Loading... |
47 const FilePath device_path(location); | 49 const FilePath device_path(location); |
48 if (!device_path.IsAbsolute() || device_path.ReferencesParent()) | 50 if (!device_path.IsAbsolute() || device_path.ReferencesParent()) |
49 return; | 51 return; |
50 | 52 |
51 std::string device_name; | 53 std::string device_name; |
52 | 54 |
53 // Register device path as an isolated file system. | 55 // Register device path as an isolated file system. |
54 // TODO(kinuko, kmadhusu): Use a different file system type for MTP. | 56 // TODO(kinuko, kmadhusu): Use a different file system type for MTP. |
55 const std::string filesystem_id = | 57 const std::string filesystem_id = |
56 fileapi::IsolatedContext::GetInstance()->RegisterFileSystemForPath( | 58 fileapi::IsolatedContext::GetInstance()->RegisterFileSystemForPath( |
57 fileapi::kFileSystemTypeIsolated, device_path, &device_name); | 59 fileapi::kFileSystemTypeNativeMedia, device_path, &device_name); |
58 | 60 |
59 CHECK(!filesystem_id.empty()); | 61 CHECK(!filesystem_id.empty()); |
60 webkit_glue::WebIntentData intent( | 62 webkit_glue::WebIntentData intent( |
61 ASCIIToUTF16("chrome-extension://attach"), | 63 ASCIIToUTF16("chrome-extension://attach"), |
62 ASCIIToUTF16("chrome-extension://filesystem"), | 64 ASCIIToUTF16("chrome-extension://filesystem"), |
63 device_name, | 65 device_name, |
64 filesystem_id); | 66 filesystem_id); |
65 | 67 |
66 delegate_->WebIntentDispatch(NULL /* no WebContents */, | 68 delegate_->WebIntentDispatch(NULL /* no WebContents */, |
67 content::WebIntentsDispatcher::Create(intent)); | 69 content::WebIntentsDispatcher::Create(intent)); |
68 } | 70 } |
OLD | NEW |