Chromium Code Reviews| 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/extensions/file_manager/file_tasks.h" | 5 #include "chrome/browser/chromeos/extensions/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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/strings/utf_string_conversions.h" | |
|
satorux1
2013/08/30 02:01:34
gone!
| |
| 11 #include "chrome/browser/chromeos/drive/drive_app_registry.h" | 12 #include "chrome/browser/chromeos/drive/drive_app_registry.h" |
| 12 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 13 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 13 #include "chrome/browser/chromeos/drive/file_task_executor.h" | 14 #include "chrome/browser/chromeos/drive/file_task_executor.h" |
| 14 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handlers. h" | 15 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handlers. h" |
| 15 #include "chrome/browser/chromeos/extensions/file_manager/fileapi_util.h" | 16 #include "chrome/browser/chromeos/extensions/file_manager/fileapi_util.h" |
| 16 #include "chrome/browser/chromeos/extensions/file_manager/open_util.h" | 17 #include "chrome/browser/chromeos/extensions/file_manager/open_util.h" |
| 17 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 18 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
| 18 #include "chrome/browser/extensions/extension_host.h" | 19 #include "chrome/browser/extensions/extension_host.h" |
| 19 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 !backend->IsAccessAllowed(files[i])) { | 105 !backend->IsAccessAllowed(files[i])) { |
| 105 return false; | 106 return false; |
| 106 } | 107 } |
| 107 } | 108 } |
| 108 | 109 |
| 109 return true; | 110 return true; |
| 110 } | 111 } |
| 111 | 112 |
| 112 } // namespace | 113 } // namespace |
| 113 | 114 |
| 115 FullTaskDescriptor::FullTaskDescriptor( | |
| 116 const TaskDescriptor& task_descriptor, | |
| 117 const std::string& task_title, | |
| 118 const GURL& icon_url, | |
| 119 bool is_default) | |
| 120 : task_descriptor_(task_descriptor), | |
| 121 task_title_(task_title), | |
| 122 icon_url_(icon_url), | |
| 123 is_default_(is_default){ | |
| 124 } | |
| 125 | |
| 126 scoped_ptr<base::DictionaryValue> | |
| 127 FullTaskDescriptor::AsDictionaryValue() const { | |
| 128 scoped_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue); | |
| 129 dictionary->SetString("taskId", TaskDescriptorToId(task_descriptor_)); | |
| 130 if (!icon_url_.is_empty()) | |
| 131 dictionary->SetString("iconUrl", icon_url_.spec()); | |
| 132 dictionary->SetBoolean("driveApp", | |
| 133 task_descriptor_.task_type == TASK_TYPE_DRIVE_APP); | |
| 134 dictionary->SetString("title", task_title_); | |
| 135 dictionary->SetBoolean("isDefault", is_default_); | |
| 136 return dictionary.Pass(); | |
| 137 } | |
| 138 | |
| 114 void UpdateDefaultTask(PrefService* pref_service, | 139 void UpdateDefaultTask(PrefService* pref_service, |
| 115 const std::string& task_id, | 140 const std::string& task_id, |
| 116 const std::set<std::string>& suffixes, | 141 const std::set<std::string>& suffixes, |
| 117 const std::set<std::string>& mime_types) { | 142 const std::set<std::string>& mime_types) { |
| 118 if (!pref_service) | 143 if (!pref_service) |
| 119 return; | 144 return; |
| 120 | 145 |
| 121 if (!mime_types.empty()) { | 146 if (!mime_types.empty()) { |
| 122 DictionaryPrefUpdate mime_type_pref(pref_service, | 147 DictionaryPrefUpdate mime_type_pref(pref_service, |
| 123 prefs::kDefaultTasksByMimeType); | 148 prefs::kDefaultTasksByMimeType); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 pref_service.GetDictionary(prefs::kDefaultTasksBySuffix); | 188 pref_service.GetDictionary(prefs::kDefaultTasksBySuffix); |
| 164 DCHECK(suffix_task_prefs); | 189 DCHECK(suffix_task_prefs); |
| 165 LOG_IF(ERROR, !suffix_task_prefs) << "Unable to open suffix prefs"; | 190 LOG_IF(ERROR, !suffix_task_prefs) << "Unable to open suffix prefs"; |
| 166 std::string lower_suffix = StringToLowerASCII(suffix); | 191 std::string lower_suffix = StringToLowerASCII(suffix); |
| 167 if (suffix_task_prefs) | 192 if (suffix_task_prefs) |
| 168 suffix_task_prefs->GetStringWithoutPathExpansion(lower_suffix, &task_id); | 193 suffix_task_prefs->GetStringWithoutPathExpansion(lower_suffix, &task_id); |
| 169 VLOG_IF(1, !task_id.empty()) << "Found suffix default handler: " << task_id; | 194 VLOG_IF(1, !task_id.empty()) << "Found suffix default handler: " << task_id; |
| 170 return task_id; | 195 return task_id; |
| 171 } | 196 } |
| 172 | 197 |
| 173 std::string MakeTaskID(const std::string& extension_id, | 198 std::string MakeTaskID(const std::string& app_id, |
| 174 TaskType task_type, | 199 TaskType task_type, |
| 175 const std::string& action_id) { | 200 const std::string& action_id) { |
| 176 return base::StringPrintf("%s|%s|%s", | 201 return base::StringPrintf("%s|%s|%s", |
| 177 extension_id.c_str(), | 202 app_id.c_str(), |
| 178 TaskTypeToString(task_type).c_str(), | 203 TaskTypeToString(task_type).c_str(), |
| 179 action_id.c_str()); | 204 action_id.c_str()); |
| 180 } | 205 } |
| 181 | 206 |
| 182 std::string MakeDriveAppTaskId(const std::string& app_id) { | 207 std::string MakeDriveAppTaskId(const std::string& app_id) { |
| 183 return MakeTaskID(app_id, TASK_TYPE_DRIVE_APP, "open-with"); | 208 return MakeTaskID(app_id, TASK_TYPE_DRIVE_APP, "open-with"); |
| 184 } | 209 } |
| 185 | 210 |
| 211 std::string TaskDescriptorToId(const TaskDescriptor& task_descriptor) { | |
| 212 return MakeTaskID(task_descriptor.app_id, | |
| 213 task_descriptor.task_type, | |
| 214 task_descriptor.action_id); | |
| 215 } | |
| 216 | |
| 186 bool ParseTaskID(const std::string& task_id, TaskDescriptor* task) { | 217 bool ParseTaskID(const std::string& task_id, TaskDescriptor* task) { |
| 187 DCHECK(task); | 218 DCHECK(task); |
| 188 | 219 |
| 189 std::vector<std::string> result; | 220 std::vector<std::string> result; |
| 190 int count = Tokenize(task_id, std::string("|"), &result); | 221 int count = Tokenize(task_id, std::string("|"), &result); |
| 191 | 222 |
| 192 // Parse a legacy task ID that only contain two parts. Drive tasks are | 223 // Parse a legacy task ID that only contain two parts. Drive tasks are |
| 193 // identified by a prefix "drive-app:" on the extension ID. The legacy task | 224 // identified by a prefix "drive-app:" on the extension ID. The legacy task |
| 194 // IDs can be stored in preferences. | 225 // IDs can be stored in preferences. |
| 195 // TODO(satorux): We should get rid of this code: crbug.com/267359. | 226 // TODO(satorux): We should get rid of this code: crbug.com/267359. |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 std::string task_id = file_tasks::GetDefaultTaskIdFromPrefs( | 377 std::string task_id = file_tasks::GetDefaultTaskIdFromPrefs( |
| 347 pref_service, mime_type, file_path.Extension()); | 378 pref_service, mime_type, file_path.Extension()); |
| 348 if (task_info_map.find(task_id) != task_info_map.end()) | 379 if (task_info_map.find(task_id) != task_info_map.end()) |
| 349 default_tasks->insert(task_id); | 380 default_tasks->insert(task_id); |
| 350 } | 381 } |
| 351 } | 382 } |
| 352 | 383 |
| 353 void CreateDriveTasks( | 384 void CreateDriveTasks( |
| 354 const TaskInfoMap& task_info_map, | 385 const TaskInfoMap& task_info_map, |
| 355 const std::set<std::string>& default_tasks, | 386 const std::set<std::string>& default_tasks, |
| 356 ListValue* result_list, | 387 std::vector<FullTaskDescriptor>* result_list, |
| 357 bool* default_already_set) { | 388 bool* default_already_set) { |
| 358 DCHECK(result_list); | 389 DCHECK(result_list); |
| 359 DCHECK(default_already_set); | 390 DCHECK(default_already_set); |
| 360 | 391 |
| 361 for (TaskInfoMap::const_iterator iter = task_info_map.begin(); | 392 for (TaskInfoMap::const_iterator iter = task_info_map.begin(); |
| 362 iter != task_info_map.end(); ++iter) { | 393 iter != task_info_map.end(); ++iter) { |
| 363 DictionaryValue* task = new DictionaryValue; | 394 bool is_default = false; |
| 364 task->SetString("taskId", iter->first); | |
| 365 task->SetString("title", iter->second.app_name); | |
| 366 | |
| 367 const GURL& icon_url = iter->second.icon_url; | |
| 368 if (!icon_url.is_empty()) | |
| 369 task->SetString("iconUrl", icon_url.spec()); | |
| 370 | |
| 371 task->SetBoolean("driveApp", true); | |
| 372 | |
| 373 // Once we set a default app, we don't want to set any more. | 395 // Once we set a default app, we don't want to set any more. |
| 374 if (!(*default_already_set) && | 396 if (!(*default_already_set) && |
| 375 default_tasks.find(iter->first) != default_tasks.end()) { | 397 default_tasks.find(iter->first) != default_tasks.end()) { |
| 376 task->SetBoolean("isDefault", true); | 398 is_default = true; |
| 377 *default_already_set = true; | 399 *default_already_set = true; |
| 378 } else { | |
| 379 task->SetBoolean("isDefault", false); | |
| 380 } | 400 } |
| 381 result_list->Append(task); | 401 |
| 402 TaskDescriptor descriptor; | |
| 403 DCHECK(ParseTaskID(iter->first, &descriptor)); | |
| 404 result_list->push_back( | |
| 405 FullTaskDescriptor(descriptor, | |
| 406 base::UTF16ToUTF8(iter->second.app_name), | |
|
satorux1
2013/08/29 08:17:34
should be gone once kinaba's patch landed.
satorux1
2013/08/30 02:01:34
removed
| |
| 407 iter->second.icon_url, | |
| 408 is_default)); | |
| 382 } | 409 } |
| 383 } | 410 } |
| 384 | 411 |
| 385 void FindDriveAppTasks( | 412 void FindDriveAppTasks( |
| 386 Profile* profile, | 413 Profile* profile, |
| 387 const PathAndMimeTypeSet& path_mime_set, | 414 const PathAndMimeTypeSet& path_mime_set, |
| 388 ListValue* result_list, | 415 std::vector<FullTaskDescriptor>* result_list, |
| 389 bool* default_already_set) { | 416 bool* default_already_set) { |
| 390 DCHECK(!path_mime_set.empty()); | 417 DCHECK(!path_mime_set.empty()); |
| 391 DCHECK(result_list); | 418 DCHECK(result_list); |
| 392 DCHECK(default_already_set); | 419 DCHECK(default_already_set); |
| 393 | 420 |
| 394 drive::DriveIntegrationService* integration_service = | 421 drive::DriveIntegrationService* integration_service = |
| 395 drive::DriveIntegrationServiceFactory::GetForProfile(profile); | 422 drive::DriveIntegrationServiceFactory::GetForProfile(profile); |
| 396 // |integration_service| is NULL if Drive is disabled. | 423 // |integration_service| is NULL if Drive is disabled. |
| 397 if (!integration_service || !integration_service->drive_app_registry()) | 424 if (!integration_service || !integration_service->drive_app_registry()) |
| 398 return; | 425 return; |
| 399 | 426 |
| 400 // Map of task_id to TaskInfo of available tasks. | 427 // Map of task_id to TaskInfo of available tasks. |
| 401 TaskInfoMap task_info_map; | 428 TaskInfoMap task_info_map; |
| 402 GetAvailableDriveTasks(*integration_service->drive_app_registry(), | 429 GetAvailableDriveTasks(*integration_service->drive_app_registry(), |
| 403 path_mime_set, | 430 path_mime_set, |
| 404 &task_info_map); | 431 &task_info_map); |
| 405 | 432 |
| 406 std::set<std::string> default_tasks; | 433 std::set<std::string> default_tasks; |
| 407 FindDefaultDriveTasks(*profile->GetPrefs(), | 434 FindDefaultDriveTasks(*profile->GetPrefs(), |
| 408 path_mime_set, | 435 path_mime_set, |
| 409 task_info_map, | 436 task_info_map, |
| 410 &default_tasks); | 437 &default_tasks); |
| 411 CreateDriveTasks( | 438 CreateDriveTasks( |
| 412 task_info_map, default_tasks, result_list, default_already_set); | 439 task_info_map, default_tasks, result_list, default_already_set); |
| 413 } | 440 } |
| 414 | 441 |
| 415 void FindFileHandlerTasks( | 442 void FindFileHandlerTasks( |
| 416 Profile* profile, | 443 Profile* profile, |
| 417 const PathAndMimeTypeSet& path_mime_set, | 444 const PathAndMimeTypeSet& path_mime_set, |
| 418 ListValue* result_list, | 445 std::vector<FullTaskDescriptor>* result_list, |
| 419 bool* default_already_set) { | 446 bool* default_already_set) { |
| 420 DCHECK(!path_mime_set.empty()); | 447 DCHECK(!path_mime_set.empty()); |
| 421 DCHECK(result_list); | 448 DCHECK(result_list); |
| 422 DCHECK(default_already_set); | 449 DCHECK(default_already_set); |
| 423 | 450 |
| 424 ExtensionService* service = profile->GetExtensionService(); | 451 ExtensionService* service = profile->GetExtensionService(); |
| 425 if (!service) | 452 if (!service) |
| 426 return; | 453 return; |
| 427 | 454 |
| 428 std::set<std::string> default_tasks; | 455 std::set<std::string> default_tasks; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 446 continue; | 473 continue; |
| 447 | 474 |
| 448 typedef std::vector<const extensions::FileHandlerInfo*> FileHandlerList; | 475 typedef std::vector<const extensions::FileHandlerInfo*> FileHandlerList; |
| 449 FileHandlerList file_handlers = | 476 FileHandlerList file_handlers = |
| 450 FindFileHandlersForFiles(*extension, path_mime_set); | 477 FindFileHandlersForFiles(*extension, path_mime_set); |
| 451 if (file_handlers.empty()) | 478 if (file_handlers.empty()) |
| 452 continue; | 479 continue; |
| 453 | 480 |
| 454 for (FileHandlerList::iterator i = file_handlers.begin(); | 481 for (FileHandlerList::iterator i = file_handlers.begin(); |
| 455 i != file_handlers.end(); ++i) { | 482 i != file_handlers.end(); ++i) { |
| 456 DictionaryValue* task = new DictionaryValue; | |
| 457 std::string task_id = file_tasks::MakeTaskID( | 483 std::string task_id = file_tasks::MakeTaskID( |
| 458 extension->id(), file_tasks::TASK_TYPE_FILE_HANDLER, (*i)->id); | 484 extension->id(), file_tasks::TASK_TYPE_FILE_HANDLER, (*i)->id); |
| 459 task->SetString("taskId", task_id); | 485 |
| 460 task->SetString("title", (*i)->title); | 486 bool is_default = false; |
| 461 if (!(*default_already_set) && ContainsKey(default_tasks, task_id)) { | 487 if (!(*default_already_set) && ContainsKey(default_tasks, task_id)) { |
| 462 task->SetBoolean("isDefault", true); | 488 is_default = true; |
| 463 *default_already_set = true; | 489 *default_already_set = true; |
| 464 } else { | |
| 465 task->SetBoolean("isDefault", false); | |
| 466 } | 490 } |
| 467 | 491 |
| 468 GURL best_icon = extensions::ExtensionIconSource::GetIconURL( | 492 GURL best_icon = extensions::ExtensionIconSource::GetIconURL( |
| 469 extension, | 493 extension, |
| 470 drive::util::kPreferredIconSize, | 494 drive::util::kPreferredIconSize, |
| 471 ExtensionIconSet::MATCH_BIGGER, | 495 ExtensionIconSet::MATCH_BIGGER, |
| 472 false, // grayscale | 496 false, // grayscale |
| 473 NULL); // exists | 497 NULL); // exists |
| 474 if (!best_icon.is_empty()) | |
| 475 task->SetString("iconUrl", best_icon.spec()); | |
| 476 else | |
| 477 task->SetString("iconUrl", kDefaultIcon); | |
| 478 | 498 |
| 479 task->SetBoolean("driveApp", false); | 499 result_list->push_back(FullTaskDescriptor( |
| 480 result_list->Append(task); | 500 TaskDescriptor(extension->id(), |
| 501 file_tasks::TASK_TYPE_FILE_HANDLER, | |
| 502 (*i)->id), | |
| 503 (*i)->title, | |
| 504 best_icon, | |
| 505 is_default)); | |
| 481 } | 506 } |
| 482 } | 507 } |
| 483 } | 508 } |
| 484 | 509 |
| 485 void FindFileBrowserHandlerTasks( | 510 void FindFileBrowserHandlerTasks( |
| 486 Profile* profile, | 511 Profile* profile, |
| 487 const std::vector<GURL>& file_urls, | 512 const std::vector<GURL>& file_urls, |
| 488 const std::vector<base::FilePath>& file_paths, | 513 const std::vector<base::FilePath>& file_paths, |
| 489 ListValue* result_list, | 514 std::vector<FullTaskDescriptor>* result_list, |
| 490 bool* default_already_set) { | 515 bool* default_already_set) { |
| 491 DCHECK(!file_paths.empty()); | 516 DCHECK(!file_paths.empty()); |
| 492 DCHECK(!file_urls.empty()); | 517 DCHECK(!file_urls.empty()); |
| 493 DCHECK(result_list); | 518 DCHECK(result_list); |
| 494 DCHECK(default_already_set); | 519 DCHECK(default_already_set); |
| 495 | 520 |
| 496 file_browser_handlers::FileBrowserHandlerList common_tasks = | 521 file_browser_handlers::FileBrowserHandlerList common_tasks = |
| 497 file_browser_handlers::FindCommonFileBrowserHandlers(profile, file_urls); | 522 file_browser_handlers::FindCommonFileBrowserHandlers(profile, file_urls); |
| 498 if (common_tasks.empty()) | 523 if (common_tasks.empty()) |
| 499 return; | 524 return; |
| 500 file_browser_handlers::FileBrowserHandlerList default_tasks = | 525 file_browser_handlers::FileBrowserHandlerList default_tasks = |
| 501 file_browser_handlers::FindDefaultFileBrowserHandlers( | 526 file_browser_handlers::FindDefaultFileBrowserHandlers( |
| 502 *profile->GetPrefs(), file_paths, common_tasks); | 527 *profile->GetPrefs(), file_paths, common_tasks); |
| 503 | 528 |
| 504 ExtensionService* service = | 529 ExtensionService* service = |
| 505 extensions::ExtensionSystem::Get(profile)->extension_service(); | 530 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 506 for (file_browser_handlers::FileBrowserHandlerList::const_iterator iter = | 531 for (file_browser_handlers::FileBrowserHandlerList::const_iterator iter = |
| 507 common_tasks.begin(); | 532 common_tasks.begin(); |
| 508 iter != common_tasks.end(); | 533 iter != common_tasks.end(); |
| 509 ++iter) { | 534 ++iter) { |
| 510 const FileBrowserHandler* handler = *iter; | 535 const FileBrowserHandler* handler = *iter; |
| 511 const std::string extension_id = handler->extension_id(); | 536 const std::string extension_id = handler->extension_id(); |
| 512 const Extension* extension = service->GetExtensionById(extension_id, false); | 537 const Extension* extension = service->GetExtensionById(extension_id, false); |
| 513 CHECK(extension); | 538 DCHECK(extension); |
| 514 DictionaryValue* task = new DictionaryValue; | 539 |
| 515 task->SetString("taskId", file_tasks::MakeTaskID( | |
| 516 extension_id, | |
| 517 file_tasks::TASK_TYPE_FILE_BROWSER_HANDLER, | |
| 518 handler->id())); | |
| 519 task->SetString("title", handler->title()); | |
| 520 // TODO(zelidrag): Figure out how to expose icon URL that task defined in | 540 // TODO(zelidrag): Figure out how to expose icon URL that task defined in |
| 521 // manifest instead of the default extension icon. | 541 // manifest instead of the default extension icon. |
| 522 GURL icon = extensions::ExtensionIconSource::GetIconURL( | 542 const GURL icon_url = extensions::ExtensionIconSource::GetIconURL( |
| 523 extension, | 543 extension, |
| 524 extension_misc::EXTENSION_ICON_BITTY, | 544 extension_misc::EXTENSION_ICON_BITTY, |
| 525 ExtensionIconSet::MATCH_BIGGER, | 545 ExtensionIconSet::MATCH_BIGGER, |
| 526 false, // grayscale | 546 false, // grayscale |
| 527 NULL); // exists | 547 NULL); // exists |
| 528 task->SetString("iconUrl", icon.spec()); | |
| 529 task->SetBoolean("driveApp", false); | |
| 530 | 548 |
| 531 // Only set the default if there isn't already a default set. | 549 // Only set the default if there isn't already a default set. |
| 550 bool is_default = false; | |
| 532 if (!*default_already_set && | 551 if (!*default_already_set && |
| 533 std::find(default_tasks.begin(), default_tasks.end(), *iter) != | 552 std::find(default_tasks.begin(), default_tasks.end(), *iter) != |
| 534 default_tasks.end()) { | 553 default_tasks.end()) { |
| 535 task->SetBoolean("isDefault", true); | 554 is_default = true; |
|
kinaba
2013/08/29 09:33:35
Add
*default_already_set = true;
satorux1
2013/08/30 02:01:34
good catch! I'm going to get rid of the clumsy def
kinaba
2013/08/30 02:19:39
Sounds good.
| |
| 536 *default_already_set = true; | |
| 537 } else { | |
| 538 task->SetBoolean("isDefault", false); | |
| 539 } | 555 } |
| 540 | 556 |
| 541 result_list->Append(task); | 557 result_list->push_back(FullTaskDescriptor( |
| 558 TaskDescriptor(extension_id, | |
| 559 file_tasks::TASK_TYPE_FILE_BROWSER_HANDLER, | |
| 560 handler->id()), | |
| 561 handler->title(), | |
| 562 icon_url, | |
| 563 is_default)); | |
| 542 } | 564 } |
| 543 } | 565 } |
| 544 | 566 |
| 545 void FindAllTypesOfTasks( | 567 void FindAllTypesOfTasks( |
| 546 Profile* profile, | 568 Profile* profile, |
| 547 const PathAndMimeTypeSet& path_mime_set, | 569 const PathAndMimeTypeSet& path_mime_set, |
| 548 const std::vector<GURL>& file_urls, | 570 const std::vector<GURL>& file_urls, |
| 549 const std::vector<base::FilePath>& file_paths, | 571 const std::vector<base::FilePath>& file_paths, |
| 550 ListValue* result_list) { | 572 std::vector<FullTaskDescriptor>* result_list) { |
| 573 DCHECK(profile); | |
| 574 DCHECK(result_list); | |
| 575 | |
| 551 // Check if file_paths contain a google document. | 576 // Check if file_paths contain a google document. |
| 552 bool has_google_document = false; | 577 bool has_google_document = false; |
| 553 for (size_t i = 0; i < file_paths.size(); ++i) { | 578 for (size_t i = 0; i < file_paths.size(); ++i) { |
| 554 if (google_apis::ResourceEntry::ClassifyEntryKindByFileExtension( | 579 if (google_apis::ResourceEntry::ClassifyEntryKindByFileExtension( |
| 555 file_paths[i]) & | 580 file_paths[i]) & |
| 556 google_apis::ResourceEntry::KIND_OF_GOOGLE_DOCUMENT) { | 581 google_apis::ResourceEntry::KIND_OF_GOOGLE_DOCUMENT) { |
| 557 has_google_document = true; | 582 has_google_document = true; |
| 558 break; | 583 break; |
| 559 } | 584 } |
| 560 } | 585 } |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 583 // be used in the same manifest.json. | 608 // be used in the same manifest.json. |
| 584 FindFileBrowserHandlerTasks(profile, | 609 FindFileBrowserHandlerTasks(profile, |
| 585 file_urls, | 610 file_urls, |
| 586 file_paths, | 611 file_paths, |
| 587 result_list, | 612 result_list, |
| 588 &default_already_set); | 613 &default_already_set); |
| 589 } | 614 } |
| 590 | 615 |
| 591 } // namespace file_tasks | 616 } // namespace file_tasks |
| 592 } // namespace file_manager | 617 } // namespace file_manager |
| OLD | NEW |