OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "apps/app_load_service.h" | 5 #include "apps/app_load_service.h" |
6 | 6 |
7 #include "apps/app_load_service_factory.h" | 7 #include "apps/app_load_service_factory.h" |
8 #include "apps/app_restore_service.h" | 8 #include "apps/app_restore_service.h" |
9 #include "apps/launcher.h" | 9 #include "apps/launcher.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 if (apps::AppRestoreService::Get(profile_)->IsAppRestorable(extension_id)) | 57 if (apps::AppRestoreService::Get(profile_)->IsAppRestorable(extension_id)) |
58 RestartApplication(extension_id); | 58 RestartApplication(extension_id); |
59 } | 59 } |
60 | 60 |
61 bool AppLoadService::LoadAndLaunch(const base::FilePath& extension_path, | 61 bool AppLoadService::LoadAndLaunch(const base::FilePath& extension_path, |
62 const base::CommandLine& command_line, | 62 const base::CommandLine& command_line, |
63 const base::FilePath& current_dir) { | 63 const base::FilePath& current_dir) { |
64 ExtensionService* extension_service = | 64 ExtensionService* extension_service = |
65 ExtensionSystem::Get(profile_)->extension_service(); | 65 ExtensionSystem::Get(profile_)->extension_service(); |
66 std::string extension_id; | 66 std::string extension_id; |
67 if (!extensions::UnpackedInstaller::Create(extension_service)-> | 67 if (!extensions::UnpackedInstaller::Create(extension_service) |
68 LoadFromCommandLine(base::FilePath(extension_path), &extension_id)) { | 68 ->LoadFromCommandLine(base::FilePath(extension_path), &extension_id, |
| 69 true /* only_allow_apps */)) { |
69 return false; | 70 return false; |
70 } | 71 } |
71 | 72 |
72 // Schedule the app to be launched once loaded. | 73 // Schedule the app to be launched once loaded. |
73 PostReloadAction& action = post_reload_actions_[extension_id]; | 74 PostReloadAction& action = post_reload_actions_[extension_id]; |
74 action.action_type = LAUNCH_FOR_LOAD_AND_LAUNCH; | 75 action.action_type = LAUNCH_FOR_LOAD_AND_LAUNCH; |
75 action.command_line = command_line; | 76 action.command_line = command_line; |
76 action.current_dir = current_dir; | 77 action.current_dir = current_dir; |
77 return true; | 78 return true; |
78 } | 79 } |
79 | 80 |
80 bool AppLoadService::Load(const base::FilePath& extension_path) { | 81 bool AppLoadService::Load(const base::FilePath& extension_path) { |
81 ExtensionService* extension_service = | 82 ExtensionService* extension_service = |
82 ExtensionSystem::Get(profile_)->extension_service(); | 83 ExtensionSystem::Get(profile_)->extension_service(); |
83 std::string extension_id; | 84 std::string extension_id; |
84 return extensions::UnpackedInstaller::Create(extension_service)-> | 85 return extensions::UnpackedInstaller::Create(extension_service) |
85 LoadFromCommandLine(base::FilePath(extension_path), &extension_id); | 86 ->LoadFromCommandLine(base::FilePath(extension_path), &extension_id, |
| 87 true /* only_allow_apps */); |
86 } | 88 } |
87 | 89 |
88 // static | 90 // static |
89 AppLoadService* AppLoadService::Get(Profile* profile) { | 91 AppLoadService* AppLoadService::Get(Profile* profile) { |
90 return apps::AppLoadServiceFactory::GetForProfile(profile); | 92 return apps::AppLoadServiceFactory::GetForProfile(profile); |
91 } | 93 } |
92 | 94 |
93 void AppLoadService::Observe(int type, | 95 void AppLoadService::Observe(int type, |
94 const content::NotificationSource& source, | 96 const content::NotificationSource& source, |
95 const content::NotificationDetails& details) { | 97 const content::NotificationDetails& details) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 Extension::DISABLE_RELOAD) != 0; | 153 Extension::DISABLE_RELOAD) != 0; |
152 } | 154 } |
153 return false; | 155 return false; |
154 } | 156 } |
155 | 157 |
156 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) { | 158 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) { |
157 return post_reload_actions_.find(extension_id) != post_reload_actions_.end(); | 159 return post_reload_actions_.find(extension_id) != post_reload_actions_.end(); |
158 } | 160 } |
159 | 161 |
160 } // namespace apps | 162 } // namespace apps |
OLD | NEW |