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/chromeos/extensions/file_browser_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
6 | 6 |
7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
8 #include <sys/statvfs.h> | 8 #include <sys/statvfs.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <utime.h> | 10 #include <utime.h> |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
603 }; | 603 }; |
604 | 604 |
605 FileBrowserPrivateAPI::FileBrowserPrivateAPI(Profile* profile) | 605 FileBrowserPrivateAPI::FileBrowserPrivateAPI(Profile* profile) |
606 : event_router_(make_scoped_refptr(new FileBrowserEventRouter(profile))) { | 606 : event_router_(make_scoped_refptr(new FileBrowserEventRouter(profile))) { |
607 extensions::ManifestHandler::Register( | 607 extensions::ManifestHandler::Register( |
608 extension_manifest_keys::kFileBrowserHandlers, | 608 extension_manifest_keys::kFileBrowserHandlers, |
609 make_linked_ptr(new FileBrowserHandlerParser)); | 609 make_linked_ptr(new FileBrowserHandlerParser)); |
610 | 610 |
611 ExtensionFunctionRegistry* registry = | 611 ExtensionFunctionRegistry* registry = |
612 ExtensionFunctionRegistry::GetInstance(); | 612 ExtensionFunctionRegistry::GetInstance(); |
613 registry->RegisterFunction<LogoutUserFunction>(); | |
613 registry->RegisterFunction<CancelFileDialogFunction>(); | 614 registry->RegisterFunction<CancelFileDialogFunction>(); |
614 registry->RegisterFunction<ExecuteTasksFileBrowserFunction>(); | 615 registry->RegisterFunction<ExecuteTasksFileBrowserFunction>(); |
615 registry->RegisterFunction<SetDefaultTaskFileBrowserFunction>(); | 616 registry->RegisterFunction<SetDefaultTaskFileBrowserFunction>(); |
616 registry->RegisterFunction<FileDialogStringsFunction>(); | 617 registry->RegisterFunction<FileDialogStringsFunction>(); |
617 registry->RegisterFunction<GetFileTasksFileBrowserFunction>(); | 618 registry->RegisterFunction<GetFileTasksFileBrowserFunction>(); |
618 registry->RegisterFunction<GetVolumeMetadataFunction>(); | 619 registry->RegisterFunction<GetVolumeMetadataFunction>(); |
619 registry->RegisterFunction<RequestLocalFileSystemFunction>(); | 620 registry->RegisterFunction<RequestLocalFileSystemFunction>(); |
620 registry->RegisterFunction<AddFileWatchBrowserFunction>(); | 621 registry->RegisterFunction<AddFileWatchBrowserFunction>(); |
621 registry->RegisterFunction<RemoveFileWatchBrowserFunction>(); | 622 registry->RegisterFunction<RemoveFileWatchBrowserFunction>(); |
622 registry->RegisterFunction<SelectFileFunction>(); | 623 registry->RegisterFunction<SelectFileFunction>(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
670 GURL origin_url = source_url.GetOrigin(); | 671 GURL origin_url = source_url.GetOrigin(); |
671 file_system_context->OpenFileSystem( | 672 file_system_context->OpenFileSystem( |
672 origin_url, fileapi::kFileSystemTypeExternal, false, // create | 673 origin_url, fileapi::kFileSystemTypeExternal, false, // create |
673 LocalFileSystemCallbackDispatcher::CreateCallback( | 674 LocalFileSystemCallbackDispatcher::CreateCallback( |
674 this, | 675 this, |
675 file_system_context, | 676 file_system_context, |
676 child_id, | 677 child_id, |
677 GetExtension())); | 678 GetExtension())); |
678 } | 679 } |
679 | 680 |
681 bool LogoutUserFunction::RunImpl() { | |
682 browser::AttemptUserExit(); | |
683 SendResponse(true); | |
asargent_no_longer_on_chrome
2013/02/14 18:49:30
nit: since you just do the work and send the respo
| |
684 return true; | |
685 } | |
686 | |
680 bool RequestLocalFileSystemFunction::RunImpl() { | 687 bool RequestLocalFileSystemFunction::RunImpl() { |
681 if (!dispatcher() || !render_view_host() || !render_view_host()->GetProcess()) | 688 if (!dispatcher() || !render_view_host() || !render_view_host()->GetProcess()) |
682 return false; | 689 return false; |
683 | 690 |
684 content::SiteInstance* site_instance = render_view_host()->GetSiteInstance(); | 691 content::SiteInstance* site_instance = render_view_host()->GetSiteInstance(); |
685 scoped_refptr<fileapi::FileSystemContext> file_system_context = | 692 scoped_refptr<fileapi::FileSystemContext> file_system_context = |
686 BrowserContext::GetStoragePartition(profile_, site_instance)-> | 693 BrowserContext::GetStoragePartition(profile_, site_instance)-> |
687 GetFileSystemContext(); | 694 GetFileSystemContext(); |
688 BrowserThread::PostTask( | 695 BrowserThread::PostTask( |
689 BrowserThread::FILE, FROM_HERE, | 696 BrowserThread::FILE, FROM_HERE, |
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2348 | 2355 |
2349 SET_STRING(IDS_FILE_BROWSER, TIME_TODAY); | 2356 SET_STRING(IDS_FILE_BROWSER, TIME_TODAY); |
2350 SET_STRING(IDS_FILE_BROWSER, TIME_YESTERDAY); | 2357 SET_STRING(IDS_FILE_BROWSER, TIME_YESTERDAY); |
2351 | 2358 |
2352 SET_STRING(IDS_FILE_BROWSER, ALL_FILES_FILTER); | 2359 SET_STRING(IDS_FILE_BROWSER, ALL_FILES_FILTER); |
2353 | 2360 |
2354 SET_STRING(IDS_FILE_BROWSER, SPACE_AVAILABLE); | 2361 SET_STRING(IDS_FILE_BROWSER, SPACE_AVAILABLE); |
2355 SET_STRING(IDS_FILE_BROWSER, WAITING_FOR_SPACE_INFO); | 2362 SET_STRING(IDS_FILE_BROWSER, WAITING_FOR_SPACE_INFO); |
2356 SET_STRING(IDS_FILE_BROWSER, FAILED_SPACE_INFO); | 2363 SET_STRING(IDS_FILE_BROWSER, FAILED_SPACE_INFO); |
2357 | 2364 |
2365 SET_STRING(IDS_FILE_BROWSER, DRIVE_NOT_REACHED); | |
2366 | |
2358 SET_STRING(IDS_FILE_BROWSER, HELP_LINK_LABEL); | 2367 SET_STRING(IDS_FILE_BROWSER, HELP_LINK_LABEL); |
2359 #undef SET_STRING | 2368 #undef SET_STRING |
2360 | 2369 |
2361 dict->SetBoolean("PDF_VIEW_ENABLED", | 2370 dict->SetBoolean("PDF_VIEW_ENABLED", |
2362 file_manager_util::ShouldBeOpenedWithPdfPlugin(profile(), ".pdf")); | 2371 file_manager_util::ShouldBeOpenedWithPdfPlugin(profile(), ".pdf")); |
2363 | 2372 |
2364 webui::SetFontAndTextDirection(dict); | 2373 webui::SetFontAndTextDirection(dict); |
2365 | 2374 |
2366 drive::DriveSystemService* system_service = | 2375 drive::DriveSystemService* system_service = |
2367 drive::DriveSystemServiceFactory::GetForProfile(profile_); | 2376 drive::DriveSystemServiceFactory::GetForProfile(profile_); |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3355 this, name.size())); | 3364 this, name.size())); |
3356 return true; | 3365 return true; |
3357 } | 3366 } |
3358 | 3367 |
3359 void ValidatePathNameLengthFunction::OnFilePathLimitRetrieved( | 3368 void ValidatePathNameLengthFunction::OnFilePathLimitRetrieved( |
3360 size_t current_length, | 3369 size_t current_length, |
3361 size_t max_length) { | 3370 size_t max_length) { |
3362 SetResult(new base::FundamentalValue(current_length <= max_length)); | 3371 SetResult(new base::FundamentalValue(current_length <= max_length)); |
3363 SendResponse(true); | 3372 SendResponse(true); |
3364 } | 3373 } |
OLD | NEW |