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/shell/browser/shell_extension_system.h" | 5 #include "apps/shell/browser/shell_extension_system.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "apps/app_window_registry.h" | 9 #include "apps/app_window_registry.h" |
10 #include "apps/browser/api/app_runtime/app_runtime_api.h" | |
11 #include "base/command_line.h" | 10 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/common/extensions/extension_file_util.h" | 13 #include "chrome/common/extensions/extension_file_util.h" |
15 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
16 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/notification_details.h" | 16 #include "content/public/browser/notification_details.h" |
18 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
19 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
20 #include "extensions/browser/event_router.h" | 19 #include "extensions/browser/event_router.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 content::Source<BrowserContext>(browser_context_), | 67 content::Source<BrowserContext>(browser_context_), |
69 content::Details<const Extension>(extension)); | 68 content::Details<const Extension>(extension)); |
70 | 69 |
71 // Inform the rest of the extensions system to start. | 70 // Inform the rest of the extensions system to start. |
72 ready_.Signal(); | 71 ready_.Signal(); |
73 content::NotificationService::current()->Notify( | 72 content::NotificationService::current()->Notify( |
74 chrome::NOTIFICATION_EXTENSIONS_READY, | 73 chrome::NOTIFICATION_EXTENSIONS_READY, |
75 content::Source<BrowserContext>(browser_context_), | 74 content::Source<BrowserContext>(browser_context_), |
76 content::NotificationService::NoDetails()); | 75 content::NotificationService::NoDetails()); |
77 | 76 |
78 // Launch the app. | 77 // This is effectively the same behavior as |
79 apps::AppEventRouter::DispatchOnLaunchedEvent(browser_context_, extension); | 78 // apps::AppEventRouter::DispatchOnLaunchedEvent without any dependency |
| 79 // on ExtensionSystem or Profile. |
| 80 scoped_ptr<base::DictionaryValue> launch_data(new base::DictionaryValue()); |
| 81 launch_data->SetBoolean("isKioskSession", false); |
| 82 scoped_ptr<base::ListValue> event_args(new base::ListValue()); |
| 83 event_args->Append(launch_data.release()); |
| 84 scoped_ptr<Event> event( |
| 85 new Event("app.runtime.onLaunched", event_args.Pass())); |
| 86 event_router_->DispatchEventWithLazyListener(extension->id(), event.Pass()); |
80 | 87 |
81 return true; | 88 return true; |
82 } | 89 } |
83 | 90 |
84 void ShellExtensionSystem::CloseApp() { | 91 void ShellExtensionSystem::CloseApp() { |
85 apps::AppWindowRegistry::Get(browser_context_) | 92 apps::AppWindowRegistry::Get(browser_context_) |
86 ->CloseAllAppWindowsForApp(app_id_); | 93 ->CloseAllAppWindowsForApp(app_id_); |
87 } | 94 } |
88 | 95 |
89 void ShellExtensionSystem::Shutdown() { | 96 void ShellExtensionSystem::Shutdown() { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 void ShellExtensionSystem::UnregisterExtensionWithRequestContexts( | 181 void ShellExtensionSystem::UnregisterExtensionWithRequestContexts( |
175 const std::string& extension_id, | 182 const std::string& extension_id, |
176 const UnloadedExtensionInfo::Reason reason) { | 183 const UnloadedExtensionInfo::Reason reason) { |
177 } | 184 } |
178 | 185 |
179 const OneShotEvent& ShellExtensionSystem::ready() const { | 186 const OneShotEvent& ShellExtensionSystem::ready() const { |
180 return ready_; | 187 return ready_; |
181 } | 188 } |
182 | 189 |
183 } // namespace extensions | 190 } // namespace extensions |
OLD | NEW |