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 EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_
6 #define EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_
11 #include "base/memory/scoped_ptr.h"
16 class DictionaryValue
;
24 namespace extensions
{
27 struct GrantedFileEntry
;
29 class AppRuntimeEventRouter
{
31 // Dispatches the onEmbedRequested event to the given app.
32 static void DispatchOnEmbedRequestedEvent(
33 content::BrowserContext
* context
,
34 scoped_ptr
<base::DictionaryValue
> app_embedding_request_data
,
35 const extensions::Extension
* extension
);
37 // Dispatches the onLaunched event to the given app.
38 static void DispatchOnLaunchedEvent(content::BrowserContext
* context
,
39 const Extension
* extension
);
41 // Dispatches the onRestarted event to the given app, providing a list of
42 // restored file entries from the previous run.
43 static void DispatchOnRestartedEvent(content::BrowserContext
* context
,
44 const Extension
* extension
);
46 // TODO(benwells): Update this comment, it is out of date.
47 // Dispatches the onLaunched event to the given app, providing launch data of
51 // "type" : "chrome-extension://fileentry",
52 // "data" : a FileEntry,
53 // "postResults" : a null function,
54 // "postFailure" : a null function
58 // The FileEntries are created from |file_system_id| and |base_name|.
59 // |handler_id| corresponds to the id of the file_handlers item in the
60 // manifest that resulted in a match which triggered this launch.
61 static void DispatchOnLaunchedEventWithFileEntries(
62 content::BrowserContext
* context
,
63 const Extension
* extension
,
64 const std::string
& handler_id
,
65 const std::vector
<std::string
>& mime_types
,
66 const std::vector
<GrantedFileEntry
>& file_entries
);
68 // |handler_id| corresponds to the id of the url_handlers item
69 // in the manifest that resulted in a match which triggered this launch.
70 static void DispatchOnLaunchedEventWithUrl(content::BrowserContext
* context
,
71 const Extension
* extension
,
72 const std::string
& handler_id
,
74 const GURL
& referrer_url
);
77 } // namespace extensions
79 #endif // EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_