| 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/devtools/devtools_file_helper.h" | 5 #include "chrome/browser/devtools/devtools_file_helper.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 DCHECK(isolated_context); | 138 DCHECK(isolated_context); |
| 139 return isolated_context; | 139 return isolated_context; |
| 140 } | 140 } |
| 141 | 141 |
| 142 std::string RegisterFileSystem(WebContents* web_contents, | 142 std::string RegisterFileSystem(WebContents* web_contents, |
| 143 const base::FilePath& path, | 143 const base::FilePath& path, |
| 144 std::string* registered_name) { | 144 std::string* registered_name) { |
| 145 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 145 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 146 CHECK(web_contents->GetURL().SchemeIs(content::kChromeDevToolsScheme)); | 146 CHECK(web_contents->GetURL().SchemeIs(content::kChromeDevToolsScheme)); |
| 147 std::string file_system_id = isolated_context()->RegisterFileSystemForPath( | 147 std::string file_system_id = isolated_context()->RegisterFileSystemForPath( |
| 148 fileapi::kFileSystemTypeNativeLocal, path, registered_name); | 148 fileapi::kFileSystemTypeNativeLocal, std::string(), path, |
| 149 registered_name); |
| 149 | 150 |
| 150 content::ChildProcessSecurityPolicy* policy = | 151 content::ChildProcessSecurityPolicy* policy = |
| 151 content::ChildProcessSecurityPolicy::GetInstance(); | 152 content::ChildProcessSecurityPolicy::GetInstance(); |
| 152 RenderViewHost* render_view_host = web_contents->GetRenderViewHost(); | 153 RenderViewHost* render_view_host = web_contents->GetRenderViewHost(); |
| 153 int renderer_id = render_view_host->GetProcess()->GetID(); | 154 int renderer_id = render_view_host->GetProcess()->GetID(); |
| 154 policy->GrantReadFileSystem(renderer_id, file_system_id); | 155 policy->GrantReadFileSystem(renderer_id, file_system_id); |
| 155 policy->GrantWriteFileSystem(renderer_id, file_system_id); | 156 policy->GrantWriteFileSystem(renderer_id, file_system_id); |
| 156 policy->GrantCreateFileForFileSystem(renderer_id, file_system_id); | 157 policy->GrantCreateFileForFileSystem(renderer_id, file_system_id); |
| 157 policy->GrantDeleteFromFileSystem(renderer_id, file_system_id); | 158 policy->GrantDeleteFromFileSystem(renderer_id, file_system_id); |
| 158 | 159 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 base::DictionaryValue* file_systems_paths_value = update.Get(); | 420 base::DictionaryValue* file_systems_paths_value = update.Get(); |
| 420 file_systems_paths_value->RemoveWithoutPathExpansion(file_system_path, NULL); | 421 file_systems_paths_value->RemoveWithoutPathExpansion(file_system_path, NULL); |
| 421 } | 422 } |
| 422 | 423 |
| 423 bool DevToolsFileHelper::IsFileSystemAdded( | 424 bool DevToolsFileHelper::IsFileSystemAdded( |
| 424 const std::string& file_system_path) { | 425 const std::string& file_system_path) { |
| 425 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 426 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 426 set<std::string> file_system_paths = GetAddedFileSystemPaths(profile_); | 427 set<std::string> file_system_paths = GetAddedFileSystemPaths(profile_); |
| 427 return file_system_paths.find(file_system_path) != file_system_paths.end(); | 428 return file_system_paths.find(file_system_path) != file_system_paths.end(); |
| 428 } | 429 } |
| OLD | NEW |