| 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/launcher.h" | 8 #include "apps/launcher.h" |
| 9 #include "apps/shell_window_registry.h" | 9 #include "apps/shell_window_registry.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/extensions/extension_host.h" | 11 #include "chrome/browser/extensions/extension_host.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/extensions/extension_system.h" | |
| 14 #include "chrome/browser/extensions/unpacked_installer.h" | 13 #include "chrome/browser/extensions/unpacked_installer.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 16 #include "content/public/browser/notification_details.h" | 15 #include "content/public/browser/notification_details.h" |
| 17 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 18 #include "content/public/browser/notification_types.h" | 17 #include "content/public/browser/notification_types.h" |
| 19 #include "extensions/browser/extension_prefs.h" | 18 #include "extensions/browser/extension_prefs.h" |
| 19 #include "extensions/browser/extension_system.h" |
| 20 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
| 21 | 21 |
| 22 using extensions::Extension; | 22 using extensions::Extension; |
| 23 using extensions::ExtensionPrefs; | 23 using extensions::ExtensionPrefs; |
| 24 using extensions::ExtensionSystem; | 24 using extensions::ExtensionSystem; |
| 25 | 25 |
| 26 namespace apps { | 26 namespace apps { |
| 27 | 27 |
| 28 AppLoadService::PostReloadAction::PostReloadAction() | 28 AppLoadService::PostReloadAction::PostReloadAction() |
| 29 : action_type(LAUNCH), | 29 : action_type(LAUNCH), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 47 ExtensionService* service = extensions::ExtensionSystem::Get(profile_)-> | 47 ExtensionService* service = extensions::ExtensionSystem::Get(profile_)-> |
| 48 extension_service(); | 48 extension_service(); |
| 49 DCHECK(service); | 49 DCHECK(service); |
| 50 service->ReloadExtension(extension_id); | 50 service->ReloadExtension(extension_id); |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool AppLoadService::LoadAndLaunch(const base::FilePath& extension_path, | 53 bool AppLoadService::LoadAndLaunch(const base::FilePath& extension_path, |
| 54 const CommandLine& command_line, | 54 const CommandLine& command_line, |
| 55 const base::FilePath& current_dir) { | 55 const base::FilePath& current_dir) { |
| 56 ExtensionService* extension_service = | 56 ExtensionService* extension_service = |
| 57 ExtensionSystem::GetForBrowserContext(profile_)->extension_service(); | 57 ExtensionSystem::Get(profile_)->extension_service(); |
| 58 std::string extension_id; | 58 std::string extension_id; |
| 59 if (!extensions::UnpackedInstaller::Create(extension_service)-> | 59 if (!extensions::UnpackedInstaller::Create(extension_service)-> |
| 60 LoadFromCommandLine(base::FilePath(extension_path), &extension_id)) { | 60 LoadFromCommandLine(base::FilePath(extension_path), &extension_id)) { |
| 61 return false; | 61 return false; |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Schedule the app to be launched once loaded. | 64 // Schedule the app to be launched once loaded. |
| 65 PostReloadAction& action = post_reload_actions_[extension_id]; | 65 PostReloadAction& action = post_reload_actions_[extension_id]; |
| 66 action.action_type = LAUNCH_WITH_COMMAND_LINE; | 66 action.action_type = LAUNCH_WITH_COMMAND_LINE; |
| 67 action.command_line = command_line; | 67 action.command_line = command_line; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 Extension::DISABLE_RELOAD) != 0; | 140 Extension::DISABLE_RELOAD) != 0; |
| 141 } | 141 } |
| 142 return false; | 142 return false; |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) { | 145 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) { |
| 146 return post_reload_actions_.find(extension_id) != post_reload_actions_.end(); | 146 return post_reload_actions_.find(extension_id) != post_reload_actions_.end(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace apps | 149 } // namespace apps |
| OLD | NEW |