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

Side by Side Diff: chrome/browser/extensions/extension_file_browser_private_api.cc

Issue 6810037: File API changes needed for safely passing user selected file entities from the file browser comp... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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/extensions/extension_local_filesystem_apitest.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_file_browser_private_api.h" 5 #include "chrome/browser/extensions/extension_file_browser_private_api.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 bool RequestLocalFileSystemFunction::RunImpl() { 74 bool RequestLocalFileSystemFunction::RunImpl() {
75 fileapi::FileSystemOperation* operation = 75 fileapi::FileSystemOperation* operation =
76 new fileapi::FileSystemOperation( 76 new fileapi::FileSystemOperation(
77 new LocalFileSystemCallbackDispatcher(this), 77 new LocalFileSystemCallbackDispatcher(this),
78 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 78 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
79 profile()->GetFileSystemContext(), 79 profile()->GetFileSystemContext(),
80 NULL); 80 NULL);
81 GURL origin_url = source_url().GetOrigin(); 81 GURL origin_url = source_url().GetOrigin();
82 operation->OpenFileSystem(origin_url, fileapi::kFileSystemTypeLocal, 82 operation->OpenFileSystem(origin_url, fileapi::kFileSystemTypeExternal,
83 false); // create 83 false); // create
84 // Will finish asynchronously. 84 // Will finish asynchronously.
85 return true; 85 return true;
86 } 86 }
87 87
88 void RequestLocalFileSystemFunction::RespondSuccessOnUIThread( 88 void RequestLocalFileSystemFunction::RespondSuccessOnUIThread(
89 const std::string& name, const GURL& root) { 89 const std::string& name, const GURL& root) {
90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
91 result_.reset(new DictionaryValue()); 91 result_.reset(new DictionaryValue());
92 DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get()); 92 DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 GURL origin_url = source_url().GetOrigin(); 164 GURL origin_url = source_url().GetOrigin();
165 fileapi::FileSystemPathManager* path_manager = 165 fileapi::FileSystemPathManager* path_manager =
166 profile()->GetFileSystemContext()->path_manager(); 166 profile()->GetFileSystemContext()->path_manager();
167 167
168 size_t len = virtual_paths_.size(); 168 size_t len = virtual_paths_.size();
169 selected_files_.reserve(len); 169 selected_files_.reserve(len);
170 for (size_t i = 0; i < len; ++i) { 170 for (size_t i = 0; i < len; ++i) {
171 std::string virtual_path = virtual_paths_[i]; 171 std::string virtual_path = virtual_paths_[i];
172 FilePath root = path_manager->GetFileSystemRootPathOnFileThread( 172 FilePath root = path_manager->GetFileSystemRootPathOnFileThread(
173 origin_url, 173 origin_url,
174 fileapi::kFileSystemTypeLocal, 174 fileapi::kFileSystemTypeExternal,
175 FilePath(virtual_path), 175 FilePath(virtual_path),
176 false); 176 false);
177 if (!root.empty()) { 177 if (!root.empty()) {
178 selected_files_.push_back(root.Append(virtual_path)); 178 selected_files_.push_back(root.Append(virtual_path));
179 } else { 179 } else {
180 LOG(WARNING) << "GetLocalPathsOnFileThread failed " << virtual_path; 180 LOG(WARNING) << "GetLocalPathsOnFileThread failed " << virtual_path;
181 } 181 }
182 } 182 }
183 #endif 183 #endif
184 184
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 SET_STRING(IDS_FILE_BROWSER, COMPUTING_SELECTION); 309 SET_STRING(IDS_FILE_BROWSER, COMPUTING_SELECTION);
310 SET_STRING(IDS_FILE_BROWSER, NOTHING_SELECTED); 310 SET_STRING(IDS_FILE_BROWSER, NOTHING_SELECTED);
311 SET_STRING(IDS_FILE_BROWSER, ONE_FILE_SELECTED); 311 SET_STRING(IDS_FILE_BROWSER, ONE_FILE_SELECTED);
312 SET_STRING(IDS_FILE_BROWSER, MANY_FILES_SELECTED); 312 SET_STRING(IDS_FILE_BROWSER, MANY_FILES_SELECTED);
313 313
314 #undef SET_STRING 314 #undef SET_STRING
315 315
316 SendResponse(true); 316 SendResponse(true);
317 return true; 317 return true;
318 } 318 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_local_filesystem_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698