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

Side by Side Diff: chrome/browser/extensions/api/file_system/file_system_api.cc

Issue 1023793002: Move absolute path conversion back to the FILE thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make check_path const. Created 5 years, 9 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
« no previous file with comments | « chrome/browser/extensions/api/file_system/file_system_api.h ('k') | no next file » | 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/extensions/api/file_system/file_system_api.h" 5 #include "chrome/browser/extensions/api/file_system/file_system_api.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "apps/saved_files_service.h" 9 #include "apps/saved_files_service.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 AppWindow* app_window = 632 AppWindow* app_window =
633 registry->GetAppWindowForRenderViewHost(render_view_host()); 633 registry->GetAppWindowForRenderViewHost(render_view_host());
634 if (!app_window) { 634 if (!app_window) {
635 error_ = kInvalidCallingPage; 635 error_ = kInvalidCallingPage;
636 SendResponse(false); 636 SendResponse(false);
637 return; 637 return;
638 } 638 }
639 content::WebContents* web_contents = app_window->web_contents(); 639 content::WebContents* web_contents = app_window->web_contents();
640 640
641 DCHECK_EQ(paths.size(), 1u); 641 DCHECK_EQ(paths.size(), 1u);
642 bool non_native_path = false;
642 #if defined(OS_CHROMEOS) 643 #if defined(OS_CHROMEOS)
643 base::FilePath check_path = 644 non_native_path =
644 file_manager::util::IsUnderNonNativeLocalPath(GetProfile(), paths[0]) 645 file_manager::util::IsUnderNonNativeLocalPath(GetProfile(), paths[0]);
645 ? paths[0]
646 : base::MakeAbsoluteFilePath(paths[0]);
647 #else
648 base::FilePath check_path = base::MakeAbsoluteFilePath(paths[0]);
649 #endif 646 #endif
650 647
651 content::BrowserThread::PostTask( 648 content::BrowserThread::PostTask(
652 content::BrowserThread::FILE, 649 content::BrowserThread::FILE,
653 FROM_HERE, 650 FROM_HERE,
654 base::Bind( 651 base::Bind(
655 &FileSystemChooseEntryFunction::ConfirmDirectoryAccessOnFileThread, 652 &FileSystemChooseEntryFunction::ConfirmDirectoryAccessOnFileThread,
656 this, 653 this,
657 check_path, 654 non_native_path,
658 paths, 655 paths,
659 web_contents)); 656 web_contents));
660 return; 657 return;
661 } 658 }
662 659
663 OnDirectoryAccessConfirmed(paths); 660 OnDirectoryAccessConfirmed(paths);
664 } 661 }
665 662
666 void FileSystemChooseEntryFunction::FileSelectionCanceled() { 663 void FileSystemChooseEntryFunction::FileSelectionCanceled() {
667 error_ = kUserCancelled; 664 error_ = kUserCancelled;
668 SendResponse(false); 665 SendResponse(false);
669 } 666 }
670 667
671 void FileSystemChooseEntryFunction::ConfirmDirectoryAccessOnFileThread( 668 void FileSystemChooseEntryFunction::ConfirmDirectoryAccessOnFileThread(
672 const base::FilePath& check_path, 669 bool non_native_path,
673 const std::vector<base::FilePath>& paths, 670 const std::vector<base::FilePath>& paths,
674 content::WebContents* web_contents) { 671 content::WebContents* web_contents) {
672 const base::FilePath check_path =
673 non_native_path ? paths[0] : base::MakeAbsoluteFilePath(paths[0]);
675 if (check_path.empty()) { 674 if (check_path.empty()) {
676 content::BrowserThread::PostTask( 675 content::BrowserThread::PostTask(
677 content::BrowserThread::UI, 676 content::BrowserThread::UI,
678 FROM_HERE, 677 FROM_HERE,
679 base::Bind(&FileSystemChooseEntryFunction::FileSelectionCanceled, 678 base::Bind(&FileSystemChooseEntryFunction::FileSelectionCanceled,
680 this)); 679 this));
681 return; 680 return;
682 } 681 }
683 682
684 for (size_t i = 0; i < arraysize(kGraylistedPaths); i++) { 683 for (size_t i = 0; i < arraysize(kGraylistedPaths); i++) {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 return false; 987 return false;
989 } 988 }
990 989
991 bool FileSystemGetObservedEntriesFunction::RunSync() { 990 bool FileSystemGetObservedEntriesFunction::RunSync() {
992 NOTIMPLEMENTED(); 991 NOTIMPLEMENTED();
993 error_ = kUnknownIdError; 992 error_ = kUnknownIdError;
994 return false; 993 return false;
995 } 994 }
996 995
997 } // namespace extensions 996 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/file_system/file_system_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698