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"
12 #include "extensions/common/constants.h"
17 class DictionaryValue
;
25 namespace extensions
{
28 struct GrantedFileEntry
;
30 class AppRuntimeEventRouter
{
32 // Dispatches the onEmbedRequested event to the given app.
33 static void DispatchOnEmbedRequestedEvent(
34 content::BrowserContext
* context
,
35 scoped_ptr
<base::DictionaryValue
> app_embedding_request_data
,
36 const extensions::Extension
* extension
);
38 // Dispatches the onLaunched event to the given app.
39 static void DispatchOnLaunchedEvent(content::BrowserContext
* context
,
40 const Extension
* extension
,
41 extensions::AppLaunchSource source
);
43 // Dispatches the onRestarted event to the given app, providing a list of
44 // restored file entries from the previous run.
45 static void DispatchOnRestartedEvent(content::BrowserContext
* context
,
46 const Extension
* extension
);
48 // TODO(benwells): Update this comment, it is out of date.
49 // Dispatches the onLaunched event to the given app, providing launch data of
53 // "type" : "chrome-extension://fileentry",
54 // "data" : a FileEntry,
55 // "postResults" : a null function,
56 // "postFailure" : a null function
60 // The FileEntries are created from |file_system_id| and |base_name|.
61 // |handler_id| corresponds to the id of the file_handlers item in the
62 // manifest that resulted in a match which triggered this launch.
63 static void DispatchOnLaunchedEventWithFileEntries(
64 content::BrowserContext
* context
,
65 const Extension
* extension
,
66 const std::string
& handler_id
,
67 const std::vector
<std::string
>& mime_types
,
68 const std::vector
<GrantedFileEntry
>& file_entries
);
70 // |handler_id| corresponds to the id of the url_handlers item
71 // in the manifest that resulted in a match which triggered this launch.
72 static void DispatchOnLaunchedEventWithUrl(content::BrowserContext
* context
,
73 const Extension
* extension
,
74 const std::string
& handler_id
,
76 const GURL
& referrer_url
);
79 } // namespace extensions
81 #endif // EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_