1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_
17 namespace extensions {
21 namespace app_file_handler_util {
22 struct GrantedFileEntry;
25 class AppEventRouter {
27 // Dispatches the onLaunched event to the given app.
28 static void DispatchOnLaunchedEvent(content::BrowserContext* context,
29 const Extension* extension);
31 // Dispatches the onRestarted event to the given app, providing a list of
32 // restored file entries from the previous run.
33 static void DispatchOnRestartedEvent(content::BrowserContext* context,
34 const Extension* extension);
36 // TODO(benwells): Update this comment, it is out of date.
37 // Dispatches the onLaunched event to the given app, providing launch data of
41 // "type" : "chrome-extension://fileentry",
42 // "data" : a FileEntry,
43 // "postResults" : a null function,
44 // "postFailure" : a null function
48 // The FileEntry is created from |file_system_id| and |base_name|.
49 // |handler_id| corresponds to the id of the file_handlers item in the
50 // manifest that resulted in a match which triggered this launch.
51 static void DispatchOnLaunchedEventWithFileEntry(
52 content::BrowserContext* context,
53 const Extension* extension,
54 const std::string& handler_id,
55 const std::string& mime_type,
56 const extensions::app_file_handler_util::GrantedFileEntry& file_entry);
58 // |handler_id| corresponds to the id of the url_handlers item
59 // in the manifest that resulted in a match which triggered this launch.
60 static void DispatchOnLaunchedEventWithUrl(content::BrowserContext* context,
61 const Extension* extension,
62 const std::string& handler_id,
64 const GURL& referrer_url);
67 } // namespace extensions
69 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_