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

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

Issue 11365181: Remove GetExtensionService from Profile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: tweaks Created 8 years, 1 month 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
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 <sys/stat.h> 7 #include <sys/stat.h>
8 #include <sys/statvfs.h> 8 #include <sys/statvfs.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <utime.h> 10 #include <utime.h>
(...skipping 19 matching lines...) Expand all
30 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" 30 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h"
31 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" 31 #include "chrome/browser/chromeos/drive/drive_file_system_util.h"
32 #include "chrome/browser/chromeos/drive/drive_system_service.h" 32 #include "chrome/browser/chromeos/drive/drive_system_service.h"
33 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" 33 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h"
34 #include "chrome/browser/chromeos/extensions/file_handler_util.h" 34 #include "chrome/browser/chromeos/extensions/file_handler_util.h"
35 #include "chrome/browser/chromeos/extensions/file_manager_util.h" 35 #include "chrome/browser/chromeos/extensions/file_manager_util.h"
36 #include "chrome/browser/chromeos/system/statistics_provider.h" 36 #include "chrome/browser/chromeos/system/statistics_provider.h"
37 #include "chrome/browser/extensions/extension_function_dispatcher.h" 37 #include "chrome/browser/extensions/extension_function_dispatcher.h"
38 #include "chrome/browser/extensions/extension_process_manager.h" 38 #include "chrome/browser/extensions/extension_process_manager.h"
39 #include "chrome/browser/extensions/extension_service.h" 39 #include "chrome/browser/extensions/extension_service.h"
40 #include "chrome/browser/extensions/extension_system.h"
40 #include "chrome/browser/extensions/extension_tab_util.h" 41 #include "chrome/browser/extensions/extension_tab_util.h"
41 #include "chrome/browser/extensions/process_map.h" 42 #include "chrome/browser/extensions/process_map.h"
42 #include "chrome/browser/google_apis/drive_service_interface.h" 43 #include "chrome/browser/google_apis/drive_service_interface.h"
43 #include "chrome/browser/google_apis/gdata_wapi_parser.h" 44 #include "chrome/browser/google_apis/gdata_wapi_parser.h"
44 #include "chrome/browser/google_apis/operation_registry.h" 45 #include "chrome/browser/google_apis/operation_registry.h"
45 #include "chrome/browser/google_apis/time_util.h" 46 #include "chrome/browser/google_apis/time_util.h"
46 #include "chrome/browser/intents/web_intents_util.h" 47 #include "chrome/browser/intents/web_intents_util.h"
47 #include "chrome/browser/profiles/profile.h" 48 #include "chrome/browser/profiles/profile.h"
48 #include "chrome/browser/ui/browser.h" 49 #include "chrome/browser/ui/browser.h"
49 #include "chrome/browser/ui/browser_window.h" 50 #include "chrome/browser/ui/browser_window.h"
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 STLDeleteContainerPairSecondPointers(app_info.begin(), app_info.end()); 793 STLDeleteContainerPairSecondPointers(app_info.begin(), app_info.end());
793 return true; 794 return true;
794 } 795 }
795 796
796 // Find Web Intent platform apps that support the View task, and add them to 797 // Find Web Intent platform apps that support the View task, and add them to
797 // the |result_list|. These will be marked as kTaskWebIntent. 798 // the |result_list|. These will be marked as kTaskWebIntent.
798 bool GetFileTasksFileBrowserFunction::FindWebIntentTasks( 799 bool GetFileTasksFileBrowserFunction::FindWebIntentTasks(
799 const std::vector<GURL>& file_urls, 800 const std::vector<GURL>& file_urls,
800 ListValue* result_list) { 801 ListValue* result_list) {
801 DCHECK(!file_urls.empty()); 802 DCHECK(!file_urls.empty());
802 ExtensionService* service = profile_->GetExtensionService(); 803 ExtensionService* service =
804 extensions::ExtensionSystem::Get(profile_)->extension_service();
803 if (!service) 805 if (!service)
804 return false; 806 return false;
805 807
806 std::set<std::string> mime_types; 808 std::set<std::string> mime_types;
807 for (std::vector<GURL>::const_iterator iter = file_urls.begin(); 809 for (std::vector<GURL>::const_iterator iter = file_urls.begin();
808 iter != file_urls.end(); ++iter) { 810 iter != file_urls.end(); ++iter) {
809 const FilePath file = FilePath(GURL(iter->spec()).ExtractFileName()); 811 const FilePath file = FilePath(GURL(iter->spec()).ExtractFileName());
810 const FilePath::StringType file_extension = 812 const FilePath::StringType file_extension =
811 StringToLowerASCII(file.Extension()); 813 StringToLowerASCII(file.Extension());
812 814
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 // the extension tasks to the Drive task list. We know there aren't duplicates 918 // the extension tasks to the Drive task list. We know there aren't duplicates
917 // because they're entirely different kinds of tasks, but there could be both 919 // because they're entirely different kinds of tasks, but there could be both
918 // kinds of tasks for a file type (an image file, for instance). 920 // kinds of tasks for a file type (an image file, for instance).
919 std::set<const FileBrowserHandler*> common_tasks; 921 std::set<const FileBrowserHandler*> common_tasks;
920 std::set<const FileBrowserHandler*> default_tasks; 922 std::set<const FileBrowserHandler*> default_tasks;
921 if (!file_handler_util::FindCommonTasks(profile_, file_urls, &common_tasks)) 923 if (!file_handler_util::FindCommonTasks(profile_, file_urls, &common_tasks))
922 return false; 924 return false;
923 file_handler_util::FindDefaultTasks(profile_, file_urls, 925 file_handler_util::FindDefaultTasks(profile_, file_urls,
924 common_tasks, &default_tasks); 926 common_tasks, &default_tasks);
925 927
926 ExtensionService* service = profile_->GetExtensionService(); 928 ExtensionService* service =
929 extensions::ExtensionSystem::Get(profile_)->extension_service();
927 for (std::set<const FileBrowserHandler*>::const_iterator iter = 930 for (std::set<const FileBrowserHandler*>::const_iterator iter =
928 common_tasks.begin(); 931 common_tasks.begin();
929 iter != common_tasks.end(); 932 iter != common_tasks.end();
930 ++iter) { 933 ++iter) {
931 const FileBrowserHandler* handler = *iter; 934 const FileBrowserHandler* handler = *iter;
932 const std::string extension_id = handler->extension_id(); 935 const std::string extension_id = handler->extension_id();
933 const Extension* extension = service->GetExtensionById(extension_id, false); 936 const Extension* extension = service->GetExtensionById(extension_id, false);
934 CHECK(extension); 937 CHECK(extension);
935 DictionaryValue* task = new DictionaryValue; 938 DictionaryValue* task = new DictionaryValue;
936 task->SetString("taskId", file_handler_util::MakeTaskID( 939 task->SetString("taskId", file_handler_util::MakeTaskID(
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after
2891 drive::DriveSystemServiceFactory::GetForProfile(profile_); 2894 drive::DriveSystemServiceFactory::GetForProfile(profile_);
2892 // |system_service| is NULL if Drive is disabled. 2895 // |system_service| is NULL if Drive is disabled.
2893 if (!system_service || !system_service->file_system()) 2896 if (!system_service || !system_service->file_system())
2894 return false; 2897 return false;
2895 2898
2896 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); 2899 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string));
2897 system_service->file_system()->RequestDirectoryRefresh(directory_path); 2900 system_service->file_system()->RequestDirectoryRefresh(directory_path);
2898 2901
2899 return true; 2902 return true;
2900 } 2903 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698