OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
6 #define EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 6 #define EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "extensions/common/constants.h" | 12 #include "extensions/common/constants.h" |
13 | 13 |
14 class GURL; | 14 class GURL; |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class DictionaryValue; | 17 class DictionaryValue; |
18 } | 18 } |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class BrowserContext; | 21 class BrowserContext; |
22 class WebContents; | 22 class WebContents; |
23 } | 23 } |
24 | 24 |
25 namespace extensions { | 25 namespace extensions { |
26 | 26 |
| 27 namespace api { |
| 28 namespace app_runtime { |
| 29 struct ActionData; |
| 30 } |
| 31 } |
| 32 |
27 class Extension; | 33 class Extension; |
28 struct EntryInfo; | 34 struct EntryInfo; |
29 struct GrantedFileEntry; | 35 struct GrantedFileEntry; |
30 | 36 |
31 class AppRuntimeEventRouter { | 37 class AppRuntimeEventRouter { |
32 public: | 38 public: |
33 // Dispatches the onEmbedRequested event to the given app. | 39 // Dispatches the onEmbedRequested event to the given app. |
34 static void DispatchOnEmbedRequestedEvent( | 40 static void DispatchOnEmbedRequestedEvent( |
35 content::BrowserContext* context, | 41 content::BrowserContext* context, |
36 std::unique_ptr<base::DictionaryValue> app_embedding_request_data, | 42 std::unique_ptr<base::DictionaryValue> app_embedding_request_data, |
37 const extensions::Extension* extension); | 43 const Extension* extension); |
38 | 44 |
39 // Dispatches the onLaunched event to the given app. | 45 // Dispatches the onLaunched event to the given app. |
40 static void DispatchOnLaunchedEvent(content::BrowserContext* context, | 46 static void DispatchOnLaunchedEvent( |
41 const Extension* extension, | 47 content::BrowserContext* context, |
42 extensions::AppLaunchSource source); | 48 const Extension* extension, |
| 49 AppLaunchSource source, |
| 50 std::unique_ptr<api::app_runtime::ActionData> action_data); |
43 | 51 |
44 // Dispatches the onRestarted event to the given app, providing a list of | 52 // Dispatches the onRestarted event to the given app, providing a list of |
45 // restored file entries from the previous run. | 53 // restored file entries from the previous run. |
46 static void DispatchOnRestartedEvent(content::BrowserContext* context, | 54 static void DispatchOnRestartedEvent(content::BrowserContext* context, |
47 const Extension* extension); | 55 const Extension* extension); |
48 | 56 |
49 // TODO(benwells): Update this comment, it is out of date. | 57 // TODO(benwells): Update this comment, it is out of date. |
50 // Dispatches the onLaunched event to the given app, providing launch data of | 58 // Dispatches the onLaunched event to the given app, providing launch data of |
51 // the form: | 59 // the form: |
52 // { | 60 // { |
53 // "intent" : { | 61 // "intent" : { |
54 // "type" : "chrome-extension://fileentry", | 62 // "type" : "chrome-extension://fileentry", |
55 // "data" : a FileEntry, | 63 // "data" : a FileEntry, |
56 // "postResults" : a null function, | 64 // "postResults" : a null function, |
57 // "postFailure" : a null function | 65 // "postFailure" : a null function |
58 // } | 66 // } |
59 // } | 67 // } |
60 | 68 |
61 // The FileEntries are created from |file_system_id| and |base_name|. | 69 // The FileEntries are created from |file_system_id| and |base_name|. |
62 // |handler_id| corresponds to the id of the file_handlers item in the | 70 // |handler_id| corresponds to the id of the file_handlers item in the |
63 // manifest that resulted in a match which triggered this launch. | 71 // manifest that resulted in a match which triggered this launch. |
64 static void DispatchOnLaunchedEventWithFileEntries( | 72 static void DispatchOnLaunchedEventWithFileEntries( |
65 content::BrowserContext* context, | 73 content::BrowserContext* context, |
66 const Extension* extension, | 74 const Extension* extension, |
| 75 AppLaunchSource source, |
67 const std::string& handler_id, | 76 const std::string& handler_id, |
68 const std::vector<EntryInfo>& entries, | 77 const std::vector<EntryInfo>& entries, |
69 const std::vector<GrantedFileEntry>& file_entries); | 78 const std::vector<GrantedFileEntry>& file_entries, |
| 79 std::unique_ptr<api::app_runtime::ActionData> action_data); |
70 | 80 |
71 // |handler_id| corresponds to the id of the url_handlers item | 81 // |handler_id| corresponds to the id of the url_handlers item |
72 // in the manifest that resulted in a match which triggered this launch. | 82 // in the manifest that resulted in a match which triggered this launch. |
73 static void DispatchOnLaunchedEventWithUrl(content::BrowserContext* context, | 83 static void DispatchOnLaunchedEventWithUrl(content::BrowserContext* context, |
74 const Extension* extension, | 84 const Extension* extension, |
75 const std::string& handler_id, | 85 const std::string& handler_id, |
76 const GURL& url, | 86 const GURL& url, |
77 const GURL& referrer_url); | 87 const GURL& referrer_url); |
78 }; | 88 }; |
79 | 89 |
80 } // namespace extensions | 90 } // namespace extensions |
81 | 91 |
82 #endif // EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 92 #endif // EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
OLD | NEW |