| 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 71 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 std::string extension = | 92 if (drive::util::HasHostedDocumentExtension(iter->first)) |
| 93 base::FilePath(iter->first.Extension()).AsUTF8Unsafe(); | |
| 94 if (drive::util::IsHostedDocumentByExtension(extension)) | |
| 95 return true; | 93 return true; |
| 96 } | 94 } |
| 97 return false; | 95 return false; |
| 98 } | 96 } |
| 99 | 97 |
| 100 // Leaves tasks handled by the file manger itself as is and removes all others. | 98 // Leaves tasks handled by the file manger itself as is and removes all others. |
| 101 void KeepOnlyFileManagerInternalTasks(std::vector<FullTaskDescriptor>* tasks) { | 99 void KeepOnlyFileManagerInternalTasks(std::vector<FullTaskDescriptor>* tasks) { |
| 102 std::vector<FullTaskDescriptor> filtered; | 100 std::vector<FullTaskDescriptor> filtered; |
| 103 for (size_t i = 0; i < tasks->size(); ++i) { | 101 for (size_t i = 0; i < tasks->size(); ++i) { |
| 104 if ((*tasks)[i].task_descriptor().app_id == kFileManagerAppId) | 102 if ((*tasks)[i].task_descriptor().app_id == kFileManagerAppId) |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 DCHECK(!task->is_default()); | 541 DCHECK(!task->is_default()); |
| 544 if (IsFallbackFileHandler(task->task_descriptor())) { | 542 if (IsFallbackFileHandler(task->task_descriptor())) { |
| 545 task->set_is_default(true); | 543 task->set_is_default(true); |
| 546 return; | 544 return; |
| 547 } | 545 } |
| 548 } | 546 } |
| 549 } | 547 } |
| 550 | 548 |
| 551 } // namespace file_tasks | 549 } // namespace file_tasks |
| 552 } // namespace file_manager | 550 } // namespace file_manager |
| OLD | NEW |