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/file_manager/open_util.h" | 5 #include "chrome/browser/chromeos/file_manager/open_util.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/metrics/user_metrics.h" |
14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
15 #include "chrome/browser/chromeos/drive/file_system_util.h" | 16 #include "chrome/browser/chromeos/drive/file_system_util.h" |
16 #include "chrome/browser/chromeos/file_manager/app_id.h" | 17 #include "chrome/browser/chromeos/file_manager/app_id.h" |
17 #include "chrome/browser/chromeos/file_manager/file_tasks.h" | 18 #include "chrome/browser/chromeos/file_manager/file_tasks.h" |
18 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 19 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
19 #include "chrome/browser/chromeos/file_manager/path_util.h" | 20 #include "chrome/browser/chromeos/file_manager/path_util.h" |
20 #include "chrome/browser/chromeos/file_manager/url_util.h" | 21 #include "chrome/browser/chromeos/file_manager/url_util.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/user_metrics.h" | |
24 #include "extensions/browser/api/file_handlers/directory_util.h" | 24 #include "extensions/browser/api/file_handlers/directory_util.h" |
25 #include "extensions/browser/api/file_handlers/mime_util.h" | 25 #include "extensions/browser/api/file_handlers/mime_util.h" |
26 #include "extensions/browser/entry_info.h" | 26 #include "extensions/browser/entry_info.h" |
27 #include "storage/browser/fileapi/file_system_backend.h" | 27 #include "storage/browser/fileapi/file_system_backend.h" |
28 #include "storage/browser/fileapi/file_system_context.h" | 28 #include "storage/browser/fileapi/file_system_context.h" |
29 #include "storage/browser/fileapi/file_system_operation_runner.h" | 29 #include "storage/browser/fileapi/file_system_operation_runner.h" |
30 #include "storage/browser/fileapi/file_system_url.h" | 30 #include "storage/browser/fileapi/file_system_url.h" |
31 | 31 |
32 using content::BrowserThread; | 32 using content::BrowserThread; |
33 using storage::FileSystemURL; | 33 using storage::FileSystemURL; |
(...skipping 29 matching lines...) Expand all Loading... |
63 // | 63 // |
64 // "open" - Open the file manager for the given folder. | 64 // "open" - Open the file manager for the given folder. |
65 // "select" - Open the file manager for the given file. The folder containing | 65 // "select" - Open the file manager for the given file. The folder containing |
66 // the file will be opened with the file selected. | 66 // the file will be opened with the file selected. |
67 void OpenFileManagerWithInternalActionId(Profile* profile, | 67 void OpenFileManagerWithInternalActionId(Profile* profile, |
68 const GURL& url, | 68 const GURL& url, |
69 const std::string& action_id) { | 69 const std::string& action_id) { |
70 DCHECK(action_id == "open" || action_id == "select"); | 70 DCHECK(action_id == "open" || action_id == "select"); |
71 if (!shell_operations_allowed) | 71 if (!shell_operations_allowed) |
72 return; | 72 return; |
73 content::RecordAction(base::UserMetricsAction("ShowFileBrowserFullTab")); | 73 base::RecordAction(base::UserMetricsAction("ShowFileBrowserFullTab")); |
74 | 74 |
75 file_tasks::TaskDescriptor task(kFileManagerAppId, | 75 file_tasks::TaskDescriptor task(kFileManagerAppId, |
76 file_tasks::TASK_TYPE_FILE_BROWSER_HANDLER, | 76 file_tasks::TASK_TYPE_FILE_BROWSER_HANDLER, |
77 action_id); | 77 action_id); |
78 ExecuteFileTaskForUrl(profile, task, url); | 78 ExecuteFileTaskForUrl(profile, task, url); |
79 } | 79 } |
80 | 80 |
81 void OpenFileMimeTypeAfterTasksListed( | 81 void OpenFileMimeTypeAfterTasksListed( |
82 Profile* profile, | 82 Profile* profile, |
83 const GURL& url, | 83 const GURL& url, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 OpenFileManagerWithInternalActionId(profile, url, "select"); | 205 OpenFileManagerWithInternalActionId(profile, url, "select"); |
206 callback.Run(platform_util::OPEN_SUCCEEDED); | 206 callback.Run(platform_util::OPEN_SUCCEEDED); |
207 } | 207 } |
208 | 208 |
209 void DisableShellOperationsForTesting() { | 209 void DisableShellOperationsForTesting() { |
210 shell_operations_allowed = false; | 210 shell_operations_allowed = false; |
211 } | 211 } |
212 | 212 |
213 } // namespace util | 213 } // namespace util |
214 } // namespace file_manager | 214 } // namespace file_manager |
OLD | NEW |