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

Side by Side Diff: chrome/browser/chromeos/extensions/file_browser_private_api.cc

Issue 10832185: FileBrowser: Hide DriveApps on Open-with menu when the selected file is not on drive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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 | « no previous file | chrome/browser/resources/file_manager/js/file_tasks.js » ('j') | 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/extensions/file_browser_private_api.h" 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 for (std::set<std::string>::iterator ext_iter = extensions.begin(); 337 for (std::set<std::string>::iterator ext_iter = extensions.begin();
338 ext_iter != extensions.end(); ++ext_iter) { 338 ext_iter != extensions.end(); ++ext_iter) {
339 pattern_list->Append(new StringValue("filesystem:*." + *ext_iter)); 339 pattern_list->Append(new StringValue("filesystem:*." + *ext_iter));
340 } 340 }
341 task->Set("patterns", pattern_list); 341 task->Set("patterns", pattern_list);
342 GURL best_icon = FindPreferredIcon(info->app_icons, 342 GURL best_icon = FindPreferredIcon(info->app_icons,
343 kPreferredIconSize); 343 kPreferredIconSize);
344 if (!best_icon.is_empty()) { 344 if (!best_icon.is_empty()) {
345 task->SetString("iconUrl", best_icon.spec()); 345 task->SetString("iconUrl", best_icon.spec());
346 } 346 }
347 task->SetBoolean("driveApp", true);
347 result_list->Append(task); 348 result_list->Append(task);
348 } 349 }
349 } 350 }
350 351
351 } // namespace 352 } // namespace
352 353
353 class RequestLocalFileSystemFunction::LocalFileSystemCallbackDispatcher { 354 class RequestLocalFileSystemFunction::LocalFileSystemCallbackDispatcher {
354 public: 355 public:
355 static fileapi::FileSystemContext::OpenFileSystemCallback CreateCallback( 356 static fileapi::FileSystemContext::OpenFileSystemCallback CreateCallback(
356 RequestLocalFileSystemFunction* function, 357 RequestLocalFileSystemFunction* function,
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 task->SetString("title", handler->title()); 694 task->SetString("title", handler->title());
694 task->Set("patterns", URLPatternSetToStringList(iter->patterns)); 695 task->Set("patterns", URLPatternSetToStringList(iter->patterns));
695 // TODO(zelidrag): Figure out how to expose icon URL that task defined in 696 // TODO(zelidrag): Figure out how to expose icon URL that task defined in
696 // manifest instead of the default extension icon. 697 // manifest instead of the default extension icon.
697 GURL icon = 698 GURL icon =
698 ExtensionIconSource::GetIconURL(extension, 699 ExtensionIconSource::GetIconURL(extension,
699 ExtensionIconSet::EXTENSION_ICON_BITTY, 700 ExtensionIconSet::EXTENSION_ICON_BITTY,
700 ExtensionIconSet::MATCH_BIGGER, 701 ExtensionIconSet::MATCH_BIGGER,
701 false, NULL); // grayscale 702 false, NULL); // grayscale
702 task->SetString("iconUrl", icon.spec()); 703 task->SetString("iconUrl", icon.spec());
704 task->SetBoolean("driveApp", false);
703 result_list->Append(task); 705 result_list->Append(task);
704 } 706 }
705 707
706 // Take the union of Drive and extension tasks: Because any extension tasks we 708 // Take the union of Drive and extension tasks: Because any extension tasks we
707 // found must apply to all of the files (intersection), and because the same 709 // found must apply to all of the files (intersection), and because the same
708 // is true of the drive apps, we simply take the union of two lists by adding 710 // is true of the drive apps, we simply take the union of two lists by adding
709 // the drive tasks to the extension task list. We know there aren't duplicates 711 // the drive tasks to the extension task list. We know there aren't duplicates
710 // because they're entirely different kinds of tasks, but there could be both 712 // because they're entirely different kinds of tasks, but there could be both
711 // kinds of tasks for a file type (an image file, for instance). 713 // kinds of tasks for a file type (an image file, for instance).
712 if (!FindDriveAppTasks(file_urls, result_list)) 714 if (!FindDriveAppTasks(file_urls, result_list))
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
2426 gdata::GDataSystemService* system_service = 2428 gdata::GDataSystemService* system_service =
2427 gdata::GDataSystemServiceFactory::GetForProfile(profile_); 2429 gdata::GDataSystemServiceFactory::GetForProfile(profile_);
2428 if (!system_service || !system_service->file_system()) 2430 if (!system_service || !system_service->file_system())
2429 return false; 2431 return false;
2430 2432
2431 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); 2433 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string));
2432 system_service->file_system()->RequestDirectoryRefresh(directory_path); 2434 system_service->file_system()->RequestDirectoryRefresh(directory_path);
2433 2435
2434 return true; 2436 return true;
2435 } 2437 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/file_tasks.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698