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/file_tasks.h" | 5 #include "chrome/browser/chromeos/file_manager/file_tasks.h" |
6 | 6 |
7 #include "apps/launcher.h" | 7 #include "apps/launcher.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 24 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
25 #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handle
r.h" | 25 #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handle
r.h" |
26 #include "chrome/common/extensions/api/file_browser_private.h" | 26 #include "chrome/common/extensions/api/file_browser_private.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
28 #include "chromeos/chromeos_switches.h" | 28 #include "chromeos/chromeos_switches.h" |
29 #include "extensions/browser/extension_host.h" | 29 #include "extensions/browser/extension_host.h" |
30 #include "extensions/browser/extension_registry.h" | 30 #include "extensions/browser/extension_registry.h" |
31 #include "extensions/browser/extension_system.h" | 31 #include "extensions/browser/extension_system.h" |
32 #include "extensions/common/constants.h" | 32 #include "extensions/common/constants.h" |
33 #include "extensions/common/extension_set.h" | 33 #include "extensions/common/extension_set.h" |
34 #include "google_apis/drive/gdata_wapi_parser.h" | 34 #include "google_apis/drive/drive_entry_kinds.h" |
35 #include "webkit/browser/fileapi/file_system_context.h" | 35 #include "webkit/browser/fileapi/file_system_context.h" |
36 #include "webkit/browser/fileapi/file_system_url.h" | 36 #include "webkit/browser/fileapi/file_system_url.h" |
37 | 37 |
38 using extensions::Extension; | 38 using extensions::Extension; |
39 using extensions::app_file_handler_util::FindFileHandlersForFiles; | 39 using extensions::app_file_handler_util::FindFileHandlersForFiles; |
40 using fileapi::FileSystemURL; | 40 using fileapi::FileSystemURL; |
41 | 41 |
42 namespace file_manager { | 42 namespace file_manager { |
43 namespace file_tasks { | 43 namespace file_tasks { |
44 | 44 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 // Legacy Drive task extension prefix, used by CrackTaskID. | 83 // Legacy Drive task extension prefix, used by CrackTaskID. |
84 const char kDriveTaskExtensionPrefix[] = "drive-app:"; | 84 const char kDriveTaskExtensionPrefix[] = "drive-app:"; |
85 const size_t kDriveTaskExtensionPrefixLength = | 85 const size_t kDriveTaskExtensionPrefixLength = |
86 arraysize(kDriveTaskExtensionPrefix) - 1; | 86 arraysize(kDriveTaskExtensionPrefix) - 1; |
87 | 87 |
88 // Returns true if path_mime_set contains a Google document. | 88 // Returns true if path_mime_set contains a Google document. |
89 bool ContainsGoogleDocument(const PathAndMimeTypeSet& path_mime_set) { | 89 bool ContainsGoogleDocument(const PathAndMimeTypeSet& path_mime_set) { |
90 for (PathAndMimeTypeSet::const_iterator iter = path_mime_set.begin(); | 90 for (PathAndMimeTypeSet::const_iterator iter = path_mime_set.begin(); |
91 iter != path_mime_set.end(); ++iter) { | 91 iter != path_mime_set.end(); ++iter) { |
92 if (google_apis::ResourceEntry::ClassifyEntryKindByFileExtension( | 92 if (google_apis::ClassifyEntryKindByFileExtension(iter->first) & |
93 iter->first) & | 93 google_apis::KIND_OF_GOOGLE_DOCUMENT) { |
94 google_apis::ResourceEntry::KIND_OF_GOOGLE_DOCUMENT) { | |
95 return true; | 94 return true; |
96 } | 95 } |
97 } | 96 } |
98 return false; | 97 return false; |
99 } | 98 } |
100 | 99 |
101 // Leaves tasks handled by the file manger itself as is and removes all others. | 100 // Leaves tasks handled by the file manger itself as is and removes all others. |
102 void KeepOnlyFileManagerInternalTasks(std::vector<FullTaskDescriptor>* tasks) { | 101 void KeepOnlyFileManagerInternalTasks(std::vector<FullTaskDescriptor>* tasks) { |
103 std::vector<FullTaskDescriptor> filtered; | 102 std::vector<FullTaskDescriptor> filtered; |
104 for (size_t i = 0; i < tasks->size(); ++i) { | 103 for (size_t i = 0; i < tasks->size(); ++i) { |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 if (file_browser_handlers::IsFallbackFileBrowserHandler( | 522 if (file_browser_handlers::IsFallbackFileBrowserHandler( |
524 task->task_descriptor())) { | 523 task->task_descriptor())) { |
525 task->set_is_default(true); | 524 task->set_is_default(true); |
526 return; | 525 return; |
527 } | 526 } |
528 } | 527 } |
529 } | 528 } |
530 | 529 |
531 } // namespace file_tasks | 530 } // namespace file_tasks |
532 } // namespace file_manager | 531 } // namespace file_manager |
OLD | NEW |