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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "chrome/browser/chromeos/drive/drive.pb.h" | 11 #include "chrome/browser/chromeos/drive/drive.pb.h" |
12 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 12 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
13 #include "chrome/browser/chromeos/drive/file_errors.h" | 13 #include "chrome/browser/chromeos/drive/file_errors.h" |
14 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 14 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
15 #include "chrome/browser/chromeos/drive/file_system_util.h" | 15 #include "chrome/browser/chromeos/drive/file_system_util.h" |
16 #include "chrome/browser/chromeos/file_manager/app_id.h" | 16 #include "chrome/browser/chromeos/file_manager/app_id.h" |
17 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 17 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
18 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" | 18 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" |
19 #include "chrome/browser/chromeos/file_manager/path_util.h" | 19 #include "chrome/browser/chromeos/file_manager/path_util.h" |
20 #include "chrome/browser/chromeos/file_manager/snapshot_manager.h" | 20 #include "chrome/browser/chromeos/file_manager/snapshot_manager.h" |
21 #include "chrome/browser/chromeos/file_manager/volume_manager.h" | 21 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
22 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 22 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/common/extensions/api/file_browser_private.h" | 24 #include "chrome/common/extensions/api/file_browser_private.h" |
25 #include "content/public/browser/child_process_security_policy.h" | 25 #include "content/public/browser/child_process_security_policy.h" |
26 #include "ui/shell_dialogs/selected_file_info.h" | 26 #include "ui/shell_dialogs/selected_file_info.h" |
27 #include "webkit/browser/fileapi/file_system_context.h" | 27 #include "storage/browser/fileapi/file_system_context.h" |
28 #include "webkit/browser/fileapi/file_system_url.h" | 28 #include "storage/browser/fileapi/file_system_url.h" |
29 | 29 |
30 namespace file_browser_private = extensions::api::file_browser_private; | 30 namespace file_browser_private = extensions::api::file_browser_private; |
31 | 31 |
32 namespace file_manager { | 32 namespace file_manager { |
33 namespace util { | 33 namespace util { |
34 namespace { | 34 namespace { |
35 | 35 |
36 // The struct is used for GetSelectedFileInfo(). | 36 // The struct is used for GetSelectedFileInfo(). |
37 struct GetSelectedFileInfoParams { | 37 struct GetSelectedFileInfoParams { |
38 GetSelectedFileInfoLocalPathOption local_path_option; | 38 GetSelectedFileInfoLocalPathOption local_path_option; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 break; | 268 break; |
269 } | 269 } |
270 } | 270 } |
271 | 271 |
272 base::FilePath GetLocalPathFromURL(content::RenderViewHost* render_view_host, | 272 base::FilePath GetLocalPathFromURL(content::RenderViewHost* render_view_host, |
273 Profile* profile, | 273 Profile* profile, |
274 const GURL& url) { | 274 const GURL& url) { |
275 DCHECK(render_view_host); | 275 DCHECK(render_view_host); |
276 DCHECK(profile); | 276 DCHECK(profile); |
277 | 277 |
278 scoped_refptr<fileapi::FileSystemContext> file_system_context = | 278 scoped_refptr<storage::FileSystemContext> file_system_context = |
279 util::GetFileSystemContextForRenderViewHost(profile, render_view_host); | 279 util::GetFileSystemContextForRenderViewHost(profile, render_view_host); |
280 | 280 |
281 const fileapi::FileSystemURL filesystem_url( | 281 const storage::FileSystemURL filesystem_url( |
282 file_system_context->CrackURL(url)); | 282 file_system_context->CrackURL(url)); |
283 base::FilePath path; | 283 base::FilePath path; |
284 if (!chromeos::FileSystemBackend::CanHandleURL(filesystem_url)) | 284 if (!chromeos::FileSystemBackend::CanHandleURL(filesystem_url)) |
285 return base::FilePath(); | 285 return base::FilePath(); |
286 return filesystem_url.path(); | 286 return filesystem_url.path(); |
287 } | 287 } |
288 | 288 |
289 void GetSelectedFileInfo(content::RenderViewHost* render_view_host, | 289 void GetSelectedFileInfo(content::RenderViewHost* render_view_host, |
290 Profile* profile, | 290 Profile* profile, |
291 const std::vector<GURL>& file_urls, | 291 const std::vector<GURL>& file_urls, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 326 } |
327 | 327 |
328 drive::EventLogger* GetLogger(Profile* profile) { | 328 drive::EventLogger* GetLogger(Profile* profile) { |
329 drive::DriveIntegrationService* service = | 329 drive::DriveIntegrationService* service = |
330 drive::DriveIntegrationServiceFactory::FindForProfile(profile); | 330 drive::DriveIntegrationServiceFactory::FindForProfile(profile); |
331 return service ? service->event_logger() : NULL; | 331 return service ? service->event_logger() : NULL; |
332 } | 332 } |
333 | 333 |
334 } // namespace util | 334 } // namespace util |
335 } // namespace file_manager | 335 } // namespace file_manager |
OLD | NEW |