Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chrome/browser/chromeos/file_manager/file_tasks.cc

Issue 127683002: Less dependency for DriveAppRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 for (PathAndMimeTypeSet::const_iterator it = path_mime_set.begin(); 324 for (PathAndMimeTypeSet::const_iterator it = path_mime_set.begin();
325 it != path_mime_set.end(); ++it) { 325 it != path_mime_set.end(); ++it) {
326 const base::FilePath& file_path = it->first; 326 const base::FilePath& file_path = it->first;
327 const std::string& mime_type = it->second; 327 const std::string& mime_type = it->second;
328 // Return immediately if a file not on Drive is found, as Drive app tasks 328 // Return immediately if a file not on Drive is found, as Drive app tasks
329 // work only if all files are on Drive. 329 // work only if all files are on Drive.
330 if (!drive::util::IsUnderDriveMountPoint(file_path)) 330 if (!drive::util::IsUnderDriveMountPoint(file_path))
331 return; 331 return;
332 332
333 ScopedVector<drive::DriveAppInfo> app_info_list; 333 std::vector<drive::DriveAppInfo> app_info_list;
334 drive_app_registry.GetAppsForFile(file_path.Extension(), 334 drive_app_registry.GetAppsForFile(file_path.Extension(),
335 mime_type, 335 mime_type,
336 &app_info_list); 336 &app_info_list);
337 337
338 if (is_first) { 338 if (is_first) {
339 // For the first file, we store all the info. 339 // For the first file, we store all the info.
340 for (size_t j = 0; j < app_info_list.size(); ++j) { 340 for (size_t j = 0; j < app_info_list.size(); ++j)
341 const drive::DriveAppInfo& app_info = *app_info_list[j]; 341 drive_app_map[app_info_list[j].app_id] = app_info_list[j];
342 drive_app_map[app_info.app_id] = app_info;
343 }
344 } else { 342 } else {
345 // For remaining files, take the intersection with the current 343 // For remaining files, take the intersection with the current
346 // result, based on the app id. 344 // result, based on the app id.
347 std::set<std::string> app_id_set; 345 std::set<std::string> app_id_set;
348 for (size_t j = 0; j < app_info_list.size(); ++j) 346 for (size_t j = 0; j < app_info_list.size(); ++j)
349 app_id_set.insert(app_info_list[j]->app_id); 347 app_id_set.insert(app_info_list[j].app_id);
350 for (DriveAppInfoMap::iterator iter = drive_app_map.begin(); 348 for (DriveAppInfoMap::iterator iter = drive_app_map.begin();
351 iter != drive_app_map.end();) { 349 iter != drive_app_map.end();) {
352 if (app_id_set.count(iter->first) == 0) { 350 if (app_id_set.count(iter->first) == 0) {
353 drive_app_map.erase(iter++); 351 drive_app_map.erase(iter++);
354 } else { 352 } else {
355 ++iter; 353 ++iter;
356 } 354 }
357 } 355 }
358 } 356 }
359 357
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 if (file_browser_handlers::IsFallbackFileBrowserHandler( 535 if (file_browser_handlers::IsFallbackFileBrowserHandler(
538 task->task_descriptor())) { 536 task->task_descriptor())) {
539 task->set_is_default(true); 537 task->set_is_default(true);
540 return; 538 return;
541 } 539 }
542 } 540 }
543 } 541 }
544 542
545 } // namespace file_tasks 543 } // namespace file_tasks
546 } // namespace file_manager 544 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698