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

Side by Side Diff: chrome/browser/chromeos/extensions/file_handler_util.cc

Issue 10536065: Fix file handler executer setting wrong cache path permissions on drive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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/chromeos/gdata/gdata_util.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) 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/extensions/file_handler_util.h" 5 #include "chrome/browser/chromeos/extensions/file_handler_util.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/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 // prevent from traversing FS hierarchy upward. 458 // prevent from traversing FS hierarchy upward.
459 external_provider->GrantFileAccessToExtension(handler_extension_->id(), 459 external_provider->GrantFileAccessToExtension(handler_extension_->id(),
460 virtual_path); 460 virtual_path);
461 461
462 // Output values. 462 // Output values.
463 GURL target_origin_url(Extension::GetBaseURLFromExtensionId( 463 GURL target_origin_url(Extension::GetBaseURLFromExtensionId(
464 handler_extension_->id())); 464 handler_extension_->id()));
465 GURL base_url = fileapi::GetFileSystemRootURI(target_origin_url, 465 GURL base_url = fileapi::GetFileSystemRootURI(target_origin_url,
466 fileapi::kFileSystemTypeExternal); 466 fileapi::kFileSystemTypeExternal);
467 file->target_file_url = GURL(base_url.spec() + virtual_path.value()); 467 file->target_file_url = GURL(base_url.spec() + virtual_path.value());
468 FilePath root(FILE_PATH_LITERAL("/")); 468 file->virtual_path = virtual_path;
469 file->virtual_path = root.Append(virtual_path);
470 file->is_directory = file_info.is_directory; 469 file->is_directory = file_info.is_directory;
471 file->absolute_path = final_file_path; 470 file->absolute_path = final_file_path;
472 return true; 471 return true;
473 } 472 }
474 473
475 FileTaskExecutor* executor_; 474 FileTaskExecutor* executor_;
476 Profile* profile_; 475 Profile* profile_;
477 // Extension source URL. 476 // Extension source URL.
478 GURL source_url_; 477 GURL source_url_;
479 scoped_refptr<const Extension> handler_extension_; 478 scoped_refptr<const Extension> handler_extension_;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 // chromeHidden.Event.dispatchJSON() method from even_binding.js. 616 // chromeHidden.Event.dispatchJSON() method from even_binding.js.
618 ListValue* files_urls = new ListValue(); 617 ListValue* files_urls = new ListValue();
619 details->Set("entries", files_urls); 618 details->Set("entries", files_urls);
620 for (FileDefinitionList::const_iterator iter = file_list.begin(); 619 for (FileDefinitionList::const_iterator iter = file_list.begin();
621 iter != file_list.end(); 620 iter != file_list.end();
622 ++iter) { 621 ++iter) {
623 DictionaryValue* file_def = new DictionaryValue(); 622 DictionaryValue* file_def = new DictionaryValue();
624 files_urls->Append(file_def); 623 files_urls->Append(file_def);
625 file_def->SetString("fileSystemName", file_system_name); 624 file_def->SetString("fileSystemName", file_system_name);
626 file_def->SetString("fileSystemRoot", file_system_root.spec()); 625 file_def->SetString("fileSystemRoot", file_system_root.spec());
627 file_def->SetString("fileFullPath", iter->virtual_path.value()); 626 FilePath root(FILE_PATH_LITERAL("/"));
627 FilePath full_path = root.Append(iter->virtual_path);
628 file_def->SetString("fileFullPath", full_path.value());
628 file_def->SetBoolean("fileIsDirectory", iter->is_directory); 629 file_def->SetBoolean("fileIsDirectory", iter->is_directory);
629 } 630 }
630 // Get tab id. 631 // Get tab id.
631 Browser* current_browser = browser(); 632 Browser* current_browser = browser();
632 if (current_browser) { 633 if (current_browser) {
633 WebContents* contents = current_browser->GetActiveWebContents(); 634 WebContents* contents = current_browser->GetActiveWebContents();
634 if (contents) 635 if (contents)
635 details->SetInteger("tab_id", ExtensionTabUtil::GetTabId(contents)); 636 details->SetInteger("tab_id", ExtensionTabUtil::GetTabId(contents));
636 } 637 }
637 638
(...skipping 20 matching lines...) Expand all
658 handler_host_permissions_.push_back(std::make_pair( 659 handler_host_permissions_.push_back(std::make_pair(
659 iter->absolute_path, 660 iter->absolute_path,
660 GetAccessPermissionsForHandler(handler_extension, action_id))); 661 GetAccessPermissionsForHandler(handler_extension, action_id)));
661 662
662 if (!gdata::util::IsUnderGDataMountPoint(iter->absolute_path)) 663 if (!gdata::util::IsUnderGDataMountPoint(iter->absolute_path))
663 continue; 664 continue;
664 665
665 // If the file is on gdata mount point, we'll have to give handler host 666 // If the file is on gdata mount point, we'll have to give handler host
666 // permissions for file's gdata cache paths. 667 // permissions for file's gdata cache paths.
667 // This has to be called on UI thread. 668 // This has to be called on UI thread.
668 gdata::util::InsertGDataCachePathsPermissions(profile_, iter->absolute_path, 669 gdata::util::InsertGDataCachePathsPermissions(profile_, iter->virtual_path,
669 &handler_host_permissions_); 670 &handler_host_permissions_);
670 } 671 }
671 } 672 }
672 673
673 void FileTaskExecutor::SetupHandlerHostFileAccessPermissions(int handler_pid) { 674 void FileTaskExecutor::SetupHandlerHostFileAccessPermissions(int handler_pid) {
674 for (size_t i = 0; i < handler_host_permissions_.size(); i++) { 675 for (size_t i = 0; i < handler_host_permissions_.size(); i++) {
675 content::ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( 676 content::ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile(
676 handler_pid, 677 handler_pid,
677 handler_host_permissions_[i].first, 678 handler_host_permissions_[i].first,
678 handler_host_permissions_[i].second); 679 handler_host_permissions_[i].second);
679 } 680 }
680 681
681 // We don't need this anymore. 682 // We don't need this anymore.
682 handler_host_permissions_.clear(); 683 handler_host_permissions_.clear();
683 } 684 }
684 685
685 } // namespace file_handler_util 686 } // namespace file_handler_util
686 687
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698