1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef APPS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_
6 #define APPS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_
17 namespace extensions {
23 namespace file_handler_util {
24 struct GrantedFileEntry;
27 class AppEventRouter {
29 // Dispatches the onLaunched event to the given app.
30 static void DispatchOnLaunchedEvent(content::BrowserContext* context,
31 const extensions::Extension* extension);
33 // Dispatches the onRestarted event to the given app, providing a list of
34 // restored file entries from the previous run.
35 static void DispatchOnRestartedEvent(content::BrowserContext* context,
36 const extensions::Extension* extension);
38 // TODO(benwells): Update this comment, it is out of date.
39 // Dispatches the onLaunched event to the given app, providing launch data of
43 // "type" : "chrome-extension://fileentry",
44 // "data" : a FileEntry,
45 // "postResults" : a null function,
46 // "postFailure" : a null function
50 // The FileEntry is created from |file_system_id| and |base_name|.
51 // |handler_id| corresponds to the id of the file_handlers item in the
52 // manifest that resulted in a match which triggered this launch.
53 static void DispatchOnLaunchedEventWithFileEntry(
54 content::BrowserContext* context,
55 const extensions::Extension* extension,
56 const std::string& handler_id,
57 const std::string& mime_type,
58 const file_handler_util::GrantedFileEntry& file_entry);
60 // |handler_id| corresponds to the id of the url_handlers item
61 // in the manifest that resulted in a match which triggered this launch.
62 static void DispatchOnLaunchedEventWithUrl(
63 content::BrowserContext* context,
64 const extensions::Extension* extension,
65 const std::string& handler_id,
67 const GURL& referrer_url);
72 #endif // APPS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_