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

Side by Side Diff: chrome/browser/chromeos/file_manager/file_browser_handlers.cc

Issue 147993003: Clarify and separate the concept of "Drive path" and "Filesystem relative path". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/chromeos/file_manager/file_browser_handlers.h" 5 #include "chrome/browser/chromeos/file_manager/file_browser_handlers.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 if (!base::PathExists(local_path) || 253 if (!base::PathExists(local_path) ||
254 base::IsLink(local_path) || 254 base::IsLink(local_path) ||
255 !base::GetFileInfo(local_path, &file_info)) { 255 !base::GetFileInfo(local_path, &file_info)) {
256 continue; 256 continue;
257 } 257 }
258 } 258 }
259 259
260 // Grant access to this particular file to target extension. This will 260 // Grant access to this particular file to target extension. This will
261 // ensure that the target extension can access only this FS entry and 261 // ensure that the target extension can access only this FS entry and
262 // prevent from traversing FS hierarchy upward. 262 // prevent from traversing FS hierarchy upward.
263 backend->GrantFileAccessToExtension( 263 backend->GrantFileAccessToExtension(handler_extension->id(), virtual_path);
264 handler_extension->id(), virtual_path);
265 264
266 // Output values. 265 // Output values.
267 FileDefinition file; 266 FileDefinition file;
268 file.virtual_path = virtual_path; 267 file.virtual_path = virtual_path;
269 file.is_directory = file_info.is_directory; 268 file.is_directory = file_info.is_directory;
270 file.absolute_path = local_path; 269 file.absolute_path = local_path;
271 file_list.push_back(file); 270 file_list.push_back(file);
272 } 271 }
273 return file_list; 272 return file_list;
274 } 273 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 // dispatchEvent() method from event_binding.js. 387 // dispatchEvent() method from event_binding.js.
389 base::ListValue* file_entries = new base::ListValue(); 388 base::ListValue* file_entries = new base::ListValue();
390 details->Set("entries", file_entries); 389 details->Set("entries", file_entries);
391 for (FileDefinitionList::const_iterator iter = file_list.begin(); 390 for (FileDefinitionList::const_iterator iter = file_list.begin();
392 iter != file_list.end(); 391 iter != file_list.end();
393 ++iter) { 392 ++iter) {
394 base::DictionaryValue* file_def = new base::DictionaryValue(); 393 base::DictionaryValue* file_def = new base::DictionaryValue();
395 file_entries->Append(file_def); 394 file_entries->Append(file_def);
396 file_def->SetString("fileSystemName", file_system_name); 395 file_def->SetString("fileSystemName", file_system_name);
397 file_def->SetString("fileSystemRoot", file_system_root.spec()); 396 file_def->SetString("fileSystemRoot", file_system_root.spec());
398 base::FilePath root(FILE_PATH_LITERAL("/")); 397 file_def->SetString("fileFullPath",
399 base::FilePath full_path = root.Append(iter->virtual_path); 398 "/" + iter->virtual_path.AsUTF8Unsafe());
400 file_def->SetString("fileFullPath", full_path.value());
401 file_def->SetBoolean("fileIsDirectory", iter->is_directory); 399 file_def->SetBoolean("fileIsDirectory", iter->is_directory);
402 } 400 }
403 401
404 scoped_ptr<extensions::Event> event(new extensions::Event( 402 scoped_ptr<extensions::Event> event(new extensions::Event(
405 "fileBrowserHandler.onExecute", event_args.Pass())); 403 "fileBrowserHandler.onExecute", event_args.Pass()));
406 event->restrict_to_browser_context = profile_; 404 event->restrict_to_browser_context = profile_;
407 event_router->DispatchEventToExtension(extension_->id(), event.Pass()); 405 event_router->DispatchEventToExtension(extension_->id(), event.Pass());
408 406
409 ExecuteDoneOnUIThread(true); 407 ExecuteDoneOnUIThread(true);
410 } 408 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 common_handlers.erase(gallery_iter); 544 common_handlers.erase(gallery_iter);
547 else 545 else
548 common_handlers.erase(watch_iter); 546 common_handlers.erase(watch_iter);
549 } 547 }
550 548
551 return common_handlers; 549 return common_handlers;
552 } 550 }
553 551
554 } // namespace file_browser_handlers 552 } // namespace file_browser_handlers
555 } // namespace file_manager 553 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698