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