blob: 220348ef5ab0c0721fd563cb15b16d3192b8c164 [file] [log] [blame]
[email protected]24c81d692013-08-07 14:09:481// Copyright 2013 The Chromium Authors. All rights reserved.
[email protected]12e540452012-05-26 07:09:362// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]24c81d692013-08-07 14:09:485#include "apps/launcher.h"
[email protected]12e540452012-05-26 07:09:366
[email protected]bdb8a1e2013-10-03 08:14:007#include "apps/apps_client.h"
[email protected]12e540452012-05-26 07:09:368#include "base/command_line.h"
[email protected]12e540452012-05-26 07:09:369#include "base/file_util.h"
[email protected]57999812013-02-24 05:40:5210#include "base/files/file_path.h"
[email protected]12e540452012-05-26 07:09:3611#include "base/logging.h"
12#include "base/memory/ref_counted.h"
[email protected]46acbf12013-06-10 18:43:4213#include "base/strings/string_util.h"
[email protected]112158af2013-06-07 23:46:1814#include "base/strings/utf_string_conversions.h"
[email protected]6e222432012-08-14 22:12:5815#include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h"
[email protected]e3b19382013-01-12 03:58:1416#include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
[email protected]fc2a40f2013-03-13 13:14:5717#include "chrome/browser/extensions/api/file_system/file_system_api.h"
[email protected]771c8d272013-05-17 09:47:4018#include "chrome/browser/extensions/event_router.h"
[email protected]12e540452012-05-26 07:09:3619#include "chrome/browser/extensions/extension_host.h"
[email protected]fc2a40f2013-03-13 13:14:5720#include "chrome/browser/extensions/extension_prefs.h"
[email protected]fc2a40f2013-03-13 13:14:5721#include "chrome/browser/extensions/extension_service.h"
[email protected]12e540452012-05-26 07:09:3622#include "chrome/browser/extensions/extension_system.h"
[email protected]12e540452012-05-26 07:09:3623#include "chrome/browser/profiles/profile.h"
[email protected]e054ea12013-08-20 00:41:5724#include "chrome/common/extensions/api/app_runtime.h"
[email protected]12e540452012-05-26 07:09:3625#include "chrome/common/extensions/extension_messages.h"
[email protected]14a18bf2013-09-26 08:42:3026#include "chrome/common/extensions/manifest_handlers/kiosk_mode_info.h"
[email protected]12e540452012-05-26 07:09:3627#include "content/public/browser/browser_thread.h"
[email protected]12e540452012-05-26 07:09:3628#include "content/public/browser/render_process_host.h"
[email protected]a6db6122012-09-03 06:00:2329#include "content/public/browser/web_contents.h"
[email protected]9fe42042013-10-29 21:13:3330#include "extensions/browser/lazy_background_task_queue.h"
[email protected]98b6d942013-11-10 00:34:0731#include "extensions/browser/process_manager.h"
[email protected]e4452d32013-11-15 23:07:4132#include "extensions/common/extension.h"
[email protected]12e540452012-05-26 07:09:3633#include "net/base/mime_util.h"
34#include "net/base/net_util.h"
[email protected]43197ea22013-09-10 15:31:5635#include "url/gurl.h"
[email protected]12e540452012-05-26 07:09:3636
[email protected]906ae212013-03-24 01:37:1337#if defined(OS_CHROMEOS)
[email protected]78a158b2013-04-23 06:57:4938#include "chrome/browser/chromeos/drive/file_errors.h"
[email protected]976309f12013-05-02 01:19:1539#include "chrome/browser/chromeos/drive/file_system_interface.h"
[email protected]4fa2fd5d2013-04-26 03:42:5240#include "chrome/browser/chromeos/drive/file_system_util.h"
[email protected]14a18bf2013-09-26 08:42:3041#include "chrome/browser/chromeos/login/user_manager.h"
[email protected]906ae212013-03-24 01:37:1342#endif
43
[email protected]c1dbcb12013-03-25 00:23:3444#if defined(OS_WIN)
45#include "win8/util/win8_util.h"
46#endif
47
[email protected]e054ea12013-08-20 00:41:5748namespace app_runtime = extensions::api::app_runtime;
49
[email protected]12e540452012-05-26 07:09:3650using content::BrowserThread;
[email protected]ffb87062013-08-29 10:02:2551using extensions::app_file_handler_util::CheckWritableFiles;
[email protected]e3b19382013-01-12 03:58:1452using extensions::app_file_handler_util::FileHandlerForId;
[email protected]99b92042013-05-03 11:26:3853using extensions::app_file_handler_util::FileHandlerCanHandleFile;
54using extensions::app_file_handler_util::FirstFileHandlerForFile;
[email protected]fc2a40f2013-03-13 13:14:5755using extensions::app_file_handler_util::CreateFileEntry;
56using extensions::app_file_handler_util::GrantedFileEntry;
[email protected]ffb87062013-08-29 10:02:2557using extensions::app_file_handler_util::HasFileSystemWritePermission;
[email protected]24c81d692013-08-07 14:09:4858using extensions::Extension;
59using extensions::ExtensionHost;
60using extensions::ExtensionSystem;
[email protected]d9ede582012-08-14 19:21:3861
[email protected]24c81d692013-08-07 14:09:4862namespace apps {
[email protected]12e540452012-05-26 07:09:3663
64namespace {
65
[email protected]9be0bad2013-04-18 05:51:3666const char kFallbackMimeType[] = "application/octet-stream";
67
[email protected]650b2d52013-02-10 03:41:4568bool MakePathAbsolute(const base::FilePath& current_directory,
69 base::FilePath* file_path) {
[email protected]a5a0be02012-07-18 05:51:5470 DCHECK(file_path);
71 if (file_path->IsAbsolute())
72 return true;
73
[email protected]15476932013-04-12 05:17:1574 if (current_directory.empty()) {
75 *file_path = base::MakeAbsoluteFilePath(*file_path);
76 return !file_path->empty();
77 }
[email protected]a5a0be02012-07-18 05:51:5478
79 if (!current_directory.IsAbsolute())
80 return false;
81
82 *file_path = current_directory.Append(*file_path);
83 return true;
84}
85
[email protected]a228c842012-09-04 10:07:0586bool GetAbsolutePathFromCommandLine(const CommandLine* command_line,
[email protected]650b2d52013-02-10 03:41:4587 const base::FilePath& current_directory,
88 base::FilePath* path) {
[email protected]a228c842012-09-04 10:07:0589 if (!command_line || !command_line->GetArgs().size())
90 return false;
91
[email protected]650b2d52013-02-10 03:41:4592 base::FilePath relative_path(command_line->GetArgs()[0]);
93 base::FilePath absolute_path(relative_path);
[email protected]a228c842012-09-04 10:07:0594 if (!MakePathAbsolute(current_directory, &absolute_path)) {
95 LOG(WARNING) << "Cannot make absolute path from " << relative_path.value();
96 return false;
97 }
98 *path = absolute_path;
99 return true;
100}
101
102// Helper method to launch the platform app |extension| with no data. This
103// should be called in the fallback case, where it has been impossible to
104// load or obtain file launch data.
105void LaunchPlatformAppWithNoData(Profile* profile, const Extension* extension) {
106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
107 extensions::AppEventRouter::DispatchOnLaunchedEvent(profile, extension);
108}
109
110// Class to handle launching of platform apps to open a specific path.
[email protected]4e04f1e2012-06-20 03:20:31111// An instance of this class is created for each launch. The lifetime of these
112// instances is managed by reference counted pointers. As long as an instance
113// has outstanding tasks on a message queue it will be retained; once all
114// outstanding tasks are completed it will be deleted.
[email protected]a228c842012-09-04 10:07:05115class PlatformAppPathLauncher
116 : public base::RefCountedThreadSafe<PlatformAppPathLauncher> {
[email protected]12e540452012-05-26 07:09:36117 public:
[email protected]a228c842012-09-04 10:07:05118 PlatformAppPathLauncher(Profile* profile,
119 const Extension* extension,
[email protected]650b2d52013-02-10 03:41:45120 const base::FilePath& file_path)
[email protected]007b3f82013-04-09 08:46:45121 : profile_(profile), extension_(extension), file_path_(file_path) {}
[email protected]12e540452012-05-26 07:09:36122
123 void Launch() {
124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
[email protected]a228c842012-09-04 10:07:05125 if (file_path_.empty()) {
126 LaunchPlatformAppWithNoData(profile_, extension_);
[email protected]12e540452012-05-26 07:09:36127 return;
128 }
129
[email protected]a228c842012-09-04 10:07:05130 DCHECK(file_path_.IsAbsolute());
[email protected]906ae212013-03-24 01:37:13131
[email protected]ffb87062013-08-29 10:02:25132 if (HasFileSystemWritePermission(extension_)) {
133 std::vector<base::FilePath> paths;
134 paths.push_back(file_path_);
135 CheckWritableFiles(
136 paths,
137 profile_,
[email protected]6b7ecdd2013-08-29 14:16:24138 false,
[email protected]ffb87062013-08-29 10:02:25139 base::Bind(&PlatformAppPathLauncher::OnFileValid, this),
140 base::Bind(&PlatformAppPathLauncher::OnFileInvalid, this));
[email protected]906ae212013-03-24 01:37:13141 return;
142 }
[email protected]906ae212013-03-24 01:37:13143
[email protected]ffb87062013-08-29 10:02:25144 OnFileValid();
[email protected]12e540452012-05-26 07:09:36145 }
146
[email protected]af8dc08e2012-11-22 01:58:42147 void LaunchWithHandler(const std::string& handler_id) {
148 handler_id_ = handler_id;
149 Launch();
150 }
151
[email protected]12e540452012-05-26 07:09:36152 private:
[email protected]a228c842012-09-04 10:07:05153 friend class base::RefCountedThreadSafe<PlatformAppPathLauncher>;
[email protected]12e540452012-05-26 07:09:36154
[email protected]a228c842012-09-04 10:07:05155 virtual ~PlatformAppPathLauncher() {}
[email protected]12e540452012-05-26 07:09:36156
[email protected]ffb87062013-08-29 10:02:25157 void OnFileValid() {
158#if defined(OS_CHROMEOS)
159 if (drive::util::IsUnderDriveMountPoint(file_path_)) {
160 PlatformAppPathLauncher::GetMimeTypeAndLaunchForDriveFile();
161 return;
162 }
163#endif
164
165 BrowserThread::PostTask(
166 BrowserThread::FILE,
167 FROM_HERE,
168 base::Bind(&PlatformAppPathLauncher::GetMimeTypeAndLaunch, this));
169 }
170
171 void OnFileInvalid(const base::FilePath& /* error_path */) {
172 LaunchWithNoLaunchData();
173 }
174
[email protected]a228c842012-09-04 10:07:05175 void GetMimeTypeAndLaunch() {
[email protected]12e540452012-05-26 07:09:36176 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
177
178 // If the file doesn't exist, or is a directory, launch with no launch data.
[email protected]7567484142013-07-11 17:36:07179 if (!base::PathExists(file_path_) ||
[email protected]dcd16612013-07-15 20:18:09180 base::DirectoryExists(file_path_)) {
[email protected]a228c842012-09-04 10:07:05181 LOG(WARNING) << "No file exists with path " << file_path_.value();
[email protected]12e540452012-05-26 07:09:36182 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
[email protected]a228c842012-09-04 10:07:05183 &PlatformAppPathLauncher::LaunchWithNoLaunchData, this));
[email protected]12e540452012-05-26 07:09:36184 return;
185 }
186
187 std::string mime_type;
[email protected]9be0bad2013-04-18 05:51:36188 if (!net::GetMimeTypeFromFile(file_path_, &mime_type))
189 mime_type = kFallbackMimeType;
[email protected]12e540452012-05-26 07:09:36190
191 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
[email protected]a228c842012-09-04 10:07:05192 &PlatformAppPathLauncher::LaunchWithMimeType, this, mime_type));
[email protected]12e540452012-05-26 07:09:36193 }
194
[email protected]906ae212013-03-24 01:37:13195#if defined(OS_CHROMEOS)
196 void GetMimeTypeAndLaunchForDriveFile() {
197 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
198
[email protected]473a336d2013-09-09 10:28:51199 drive::FileSystemInterface* file_system =
200 drive::util::GetFileSystemByProfile(profile_);
201 if (!file_system) {
[email protected]906ae212013-03-24 01:37:13202 LaunchWithNoLaunchData();
203 return;
204 }
205
[email protected]6297d0a2013-11-07 14:06:14206 file_system->GetFile(
[email protected]906ae212013-03-24 01:37:13207 drive::util::ExtractDrivePath(file_path_),
208 base::Bind(&PlatformAppPathLauncher::OnGotDriveFile, this));
209 }
210
[email protected]78a158b2013-04-23 06:57:49211 void OnGotDriveFile(drive::FileError error,
[email protected]906ae212013-03-24 01:37:13212 const base::FilePath& file_path,
[email protected]ce5b5152013-05-08 07:27:10213 scoped_ptr<drive::ResourceEntry> entry) {
[email protected]906ae212013-03-24 01:37:13214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
215
[email protected]ce5b5152013-05-08 07:27:10216 if (error != drive::FILE_ERROR_OK ||
217 !entry || entry->file_specific_info().is_hosted_document()) {
[email protected]906ae212013-03-24 01:37:13218 LaunchWithNoLaunchData();
219 return;
220 }
221
[email protected]ce5b5152013-05-08 07:27:10222 const std::string& mime_type =
223 entry->file_specific_info().content_mime_type();
[email protected]9be0bad2013-04-18 05:51:36224 LaunchWithMimeType(mime_type.empty() ? kFallbackMimeType : mime_type);
[email protected]906ae212013-03-24 01:37:13225 }
226#endif // defined(OS_CHROMEOS)
227
[email protected]a228c842012-09-04 10:07:05228 void LaunchWithNoLaunchData() {
229 // This method is required as an entry point on the UI thread.
230 LaunchPlatformAppWithNoData(profile_, extension_);
231 }
232
233 void LaunchWithMimeType(const std::string& mime_type) {
[email protected]8427a0622013-02-11 17:00:57234 // Find file handler from the platform app for the file being opened.
[email protected]24c81d692013-08-07 14:09:48235 const extensions::FileHandlerInfo* handler = NULL;
[email protected]af8dc08e2012-11-22 01:58:42236 if (!handler_id_.empty())
237 handler = FileHandlerForId(*extension_, handler_id_);
238 else
[email protected]99b92042013-05-03 11:26:38239 handler = FirstFileHandlerForFile(*extension_, mime_type, file_path_);
240 if (handler && !FileHandlerCanHandleFile(*handler, mime_type, file_path_)) {
[email protected]af8dc08e2012-11-22 01:58:42241 LOG(WARNING) << "Extension does not provide a valid file handler for "
242 << file_path_.value();
243 LaunchWithNoLaunchData();
244 return;
245 }
[email protected]af8dc08e2012-11-22 01:58:42246
[email protected]8427a0622013-02-11 17:00:57247 // If this app doesn't have a file handler that supports the file, launch
248 // with no launch data.
249 if (!handler) {
[email protected]af8dc08e2012-11-22 01:58:42250 LOG(WARNING) << "Extension does not provide a valid file handler for "
[email protected]a228c842012-09-04 10:07:05251 << file_path_.value();
[email protected]12e540452012-05-26 07:09:36252 LaunchWithNoLaunchData();
253 return;
254 }
255
[email protected]56573d72013-05-09 06:36:37256 if (handler_id_.empty())
257 handler_id_ = handler->id;
258
[email protected]4e04f1e2012-06-20 03:20:31259 // Access needs to be granted to the file for the process associated with
260 // the extension. To do this the ExtensionHost is needed. This might not be
[email protected]12e540452012-05-26 07:09:36261 // available, or it might be in the process of being unloaded, in which case
[email protected]4e04f1e2012-06-20 03:20:31262 // the lazy background task queue is used to load the extension and then
[email protected]12e540452012-05-26 07:09:36263 // call back to us.
[email protected]24c81d692013-08-07 14:09:48264 extensions::LazyBackgroundTaskQueue* queue =
[email protected]12e540452012-05-26 07:09:36265 ExtensionSystem::Get(profile_)->lazy_background_task_queue();
266 if (queue->ShouldEnqueueTask(profile_, extension_)) {
[email protected]4e04f1e2012-06-20 03:20:31267 queue->AddPendingTask(profile_, extension_->id(), base::Bind(
[email protected]a228c842012-09-04 10:07:05268 &PlatformAppPathLauncher::GrantAccessToFileAndLaunch,
269 this, mime_type));
[email protected]12e540452012-05-26 07:09:36270 return;
271 }
272
[email protected]98b6d942013-11-10 00:34:07273 extensions::ProcessManager* process_manager =
[email protected]12e540452012-05-26 07:09:36274 ExtensionSystem::Get(profile_)->process_manager();
[email protected]e3b19382013-01-12 03:58:14275 ExtensionHost* host =
[email protected]4e04f1e2012-06-20 03:20:31276 process_manager->GetBackgroundHostForExtension(extension_->id());
[email protected]12e540452012-05-26 07:09:36277 DCHECK(host);
[email protected]a228c842012-09-04 10:07:05278 GrantAccessToFileAndLaunch(mime_type, host);
[email protected]12e540452012-05-26 07:09:36279 }
280
[email protected]a228c842012-09-04 10:07:05281 void GrantAccessToFileAndLaunch(const std::string& mime_type,
[email protected]e3b19382013-01-12 03:58:14282 ExtensionHost* host) {
[email protected]12e540452012-05-26 07:09:36283 // If there was an error loading the app page, |host| will be NULL.
284 if (!host) {
285 LOG(ERROR) << "Could not load app page for " << extension_->id();
286 return;
287 }
288
[email protected]6b7ecdd2013-08-29 14:16:24289 GrantedFileEntry file_entry =
290 CreateFileEntry(profile_,
291 extension_,
292 host->render_process_host()->GetID(),
293 file_path_,
294 false);
[email protected]24c81d692013-08-07 14:09:48295 extensions::AppEventRouter::DispatchOnLaunchedEventWithFileEntry(
[email protected]e58eb5c2013-05-13 09:42:28296 profile_, extension_, handler_id_, mime_type, file_entry);
[email protected]12e540452012-05-26 07:09:36297 }
298
[email protected]4e04f1e2012-06-20 03:20:31299 // The profile the app should be run in.
[email protected]12e540452012-05-26 07:09:36300 Profile* profile_;
[email protected]4e04f1e2012-06-20 03:20:31301 // The extension providing the app.
[email protected]12e540452012-05-26 07:09:36302 const Extension* extension_;
[email protected]a228c842012-09-04 10:07:05303 // The path to be passed through to the app.
[email protected]650b2d52013-02-10 03:41:45304 const base::FilePath file_path_;
[email protected]af8dc08e2012-11-22 01:58:42305 // The ID of the file handler used to launch the app.
306 std::string handler_id_;
[email protected]12e540452012-05-26 07:09:36307
[email protected]a228c842012-09-04 10:07:05308 DISALLOW_COPY_AND_ASSIGN(PlatformAppPathLauncher);
[email protected]4e04f1e2012-06-20 03:20:31309};
310
[email protected]12e540452012-05-26 07:09:36311} // namespace
312
[email protected]2a69b942013-05-31 09:37:53313void LaunchPlatformAppWithCommandLine(Profile* profile,
314 const Extension* extension,
315 const CommandLine* command_line,
316 const base::FilePath& current_directory) {
[email protected]bdb8a1e2013-10-03 08:14:00317 if (!AppsClient::Get()->CheckAppLaunch(profile, extension))
[email protected]14a18bf2013-09-26 08:42:30318 return;
[email protected]14a18bf2013-09-26 08:42:30319
320 // An app with "kiosk_only" should not be installed and launched
321 // outside of ChromeOS kiosk mode in the first place. This is a defensive
322 // check in case this scenario does occur.
323 if (extensions::KioskModeInfo::IsKioskOnly(extension)) {
324 bool in_kiosk_mode = false;
325#if defined(OS_CHROMEOS)
326 chromeos::UserManager* user_manager = chromeos::UserManager::Get();
327 in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp();
328#endif
329 if (!in_kiosk_mode) {
330 LOG(ERROR) << "App with 'kiosk_only' attribute must be run in "
331 << " ChromeOS kiosk mode.";
332 NOTREACHED();
[email protected]8a011172013-08-09 04:29:23333 return;
334 }
[email protected]14a18bf2013-09-26 08:42:30335 }
[email protected]8a011172013-08-09 04:29:23336
[email protected]650b2d52013-02-10 03:41:45337 base::FilePath path;
[email protected]a228c842012-09-04 10:07:05338 if (!GetAbsolutePathFromCommandLine(command_line, current_directory, &path)) {
339 LaunchPlatformAppWithNoData(profile, extension);
340 return;
341 }
342
[email protected]af8dc08e2012-11-22 01:58:42343 // TODO(benwells): add a command-line argument to provide a handler ID.
[email protected]a228c842012-09-04 10:07:05344 LaunchPlatformAppWithPath(profile, extension, path);
345}
346
347void LaunchPlatformAppWithPath(Profile* profile,
348 const Extension* extension,
[email protected]650b2d52013-02-10 03:41:45349 const base::FilePath& file_path) {
[email protected]12e540452012-05-26 07:09:36350 // launcher will be freed when nothing has a reference to it. The message
351 // queue will retain a reference for any outstanding task, so when the
352 // launcher has finished it will be freed.
[email protected]a228c842012-09-04 10:07:05353 scoped_refptr<PlatformAppPathLauncher> launcher =
354 new PlatformAppPathLauncher(profile, extension, file_path);
[email protected]12e540452012-05-26 07:09:36355 launcher->Launch();
356}
357
[email protected]2a69b942013-05-31 09:37:53358void LaunchPlatformApp(Profile* profile, const Extension* extension) {
359 LaunchPlatformAppWithCommandLine(profile, extension, NULL, base::FilePath());
360}
361
[email protected]af8dc08e2012-11-22 01:58:42362void LaunchPlatformAppWithFileHandler(Profile* profile,
363 const Extension* extension,
364 const std::string& handler_id,
[email protected]650b2d52013-02-10 03:41:45365 const base::FilePath& file_path) {
[email protected]af8dc08e2012-11-22 01:58:42366 scoped_refptr<PlatformAppPathLauncher> launcher =
367 new PlatformAppPathLauncher(profile, extension, file_path);
368 launcher->LaunchWithHandler(handler_id);
369}
370
[email protected]961745f2013-05-25 14:09:24371void RestartPlatformApp(Profile* profile, const Extension* extension) {
[email protected]af59f322013-08-07 06:10:10372#if defined(OS_WIN)
373 // On Windows 8's single window Metro mode we can not launch platform apps.
374 // In restart we are just making sure launch doesn't slip through.
375 if (win8::IsSingleWindowMetroMode())
376 return;
377#endif
[email protected]771c8d272013-05-17 09:47:40378 extensions::EventRouter* event_router =
379 ExtensionSystem::Get(profile)->event_router();
380 bool listening_to_restart = event_router->
[email protected]24c81d692013-08-07 14:09:48381 ExtensionHasEventListener(extension->id(),
[email protected]e054ea12013-08-20 00:41:57382 app_runtime::OnRestarted::kEventName);
[email protected]771c8d272013-05-17 09:47:40383
384 if (listening_to_restart) {
[email protected]961745f2013-05-25 14:09:24385 extensions::AppEventRouter::DispatchOnRestartedEvent(profile, extension);
[email protected]771c8d272013-05-17 09:47:40386 return;
387 }
388
[email protected]24c81d692013-08-07 14:09:48389 extensions::ExtensionPrefs* extension_prefs = ExtensionSystem::Get(profile)->
[email protected]771c8d272013-05-17 09:47:40390 extension_service()->extension_prefs();
[email protected]4b7111f22013-06-18 14:22:12391 bool had_windows = extension_prefs->IsActive(extension->id());
392 extension_prefs->SetIsActive(extension->id(), false);
[email protected]771c8d272013-05-17 09:47:40393 bool listening_to_launch = event_router->
[email protected]24c81d692013-08-07 14:09:48394 ExtensionHasEventListener(extension->id(),
[email protected]e054ea12013-08-20 00:41:57395 app_runtime::OnLaunched::kEventName);
[email protected]771c8d272013-05-17 09:47:40396
397 if (listening_to_launch && had_windows)
398 LaunchPlatformAppWithNoData(profile, extension);
[email protected]fc2a40f2013-03-13 13:14:57399}
400
[email protected]43197ea22013-09-10 15:31:56401void LaunchPlatformAppWithUrl(Profile* profile,
402 const Extension* extension,
403 const std::string& handler_id,
404 const GURL& url,
405 const GURL& referrer_url) {
406 extensions::AppEventRouter::DispatchOnLaunchedEventWithUrl(
407 profile, extension, handler_id, url, referrer_url);
408}
409
[email protected]24c81d692013-08-07 14:09:48410} // namespace apps