| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_manager/private_api_util.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/location.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/message_loop/message_loop.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 16 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 15 #include "chrome/browser/chromeos/drive/file_system_util.h" | 17 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 16 #include "chrome/browser/chromeos/file_manager/app_id.h" | 18 #include "chrome/browser/chromeos/file_manager/app_id.h" |
| 17 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 19 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 18 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" | 20 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" |
| 19 #include "chrome/browser/chromeos/file_manager/path_util.h" | 21 #include "chrome/browser/chromeos/file_manager/path_util.h" |
| 20 #include "chrome/browser/chromeos/file_manager/snapshot_manager.h" | 22 #include "chrome/browser/chromeos/file_manager/snapshot_manager.h" |
| 21 #include "chrome/browser/chromeos/file_manager/volume_manager.h" | 23 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
| 22 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 24 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 for (size_t i = 0; i < file_urls.size(); ++i) { | 343 for (size_t i = 0; i < file_urls.size(); ++i) { |
| 342 const GURL& file_url = file_urls[i]; | 344 const GURL& file_url = file_urls[i]; |
| 343 const base::FilePath path = GetLocalPathFromURL( | 345 const base::FilePath path = GetLocalPathFromURL( |
| 344 render_frame_host, profile, file_url); | 346 render_frame_host, profile, file_url); |
| 345 if (!path.empty()) { | 347 if (!path.empty()) { |
| 346 DVLOG(1) << "Selected: file path: " << path.value(); | 348 DVLOG(1) << "Selected: file path: " << path.value(); |
| 347 params->file_paths.push_back(path); | 349 params->file_paths.push_back(path); |
| 348 } | 350 } |
| 349 } | 351 } |
| 350 | 352 |
| 351 base::MessageLoop::current()->PostTask( | 353 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 352 FROM_HERE, | 354 FROM_HERE, |
| 353 base::Bind(&GetSelectedFileInfoInternal, profile, base::Passed(¶ms))); | 355 base::Bind(&GetSelectedFileInfoInternal, profile, base::Passed(¶ms))); |
| 354 } | 356 } |
| 355 | 357 |
| 356 void SetupProfileFileAccessPermissions(int render_view_process_id, | 358 void SetupProfileFileAccessPermissions(int render_view_process_id, |
| 357 Profile* profile) { | 359 Profile* profile) { |
| 358 const base::FilePath paths[] = { | 360 const base::FilePath paths[] = { |
| 359 drive::util::GetDriveMountPointPath(profile), | 361 drive::util::GetDriveMountPointPath(profile), |
| 360 util::GetDownloadsFolderForProfile(profile), | 362 util::GetDownloadsFolderForProfile(profile), |
| 361 }; | 363 }; |
| 362 for (size_t i = 0; i < arraysize(paths); ++i) { | 364 for (size_t i = 0; i < arraysize(paths); ++i) { |
| 363 content::ChildProcessSecurityPolicy::GetInstance( | 365 content::ChildProcessSecurityPolicy::GetInstance( |
| 364 )->GrantCreateReadWriteFile(render_view_process_id, paths[i]); | 366 )->GrantCreateReadWriteFile(render_view_process_id, paths[i]); |
| 365 } | 367 } |
| 366 } | 368 } |
| 367 | 369 |
| 368 drive::EventLogger* GetLogger(Profile* profile) { | 370 drive::EventLogger* GetLogger(Profile* profile) { |
| 369 drive::DriveIntegrationService* service = | 371 drive::DriveIntegrationService* service = |
| 370 drive::DriveIntegrationServiceFactory::FindForProfile(profile); | 372 drive::DriveIntegrationServiceFactory::FindForProfile(profile); |
| 371 return service ? service->event_logger() : NULL; | 373 return service ? service->event_logger() : NULL; |
| 372 } | 374 } |
| 373 | 375 |
| 374 } // namespace util | 376 } // namespace util |
| 375 } // namespace file_manager | 377 } // namespace file_manager |
| OLD | NEW |