OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 5 #ifndef APPS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 6 #define APPS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 class GURL; | 10 class GURL; |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class BrowserContext; | 13 class BrowserContext; |
14 class WebContents; | 14 class WebContents; |
15 } | 15 } |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
| 18 class Extension; |
| 19 } |
18 | 20 |
19 class Extension; | 21 namespace apps { |
20 | 22 |
21 namespace app_file_handler_util { | 23 namespace file_handler_util { |
22 struct GrantedFileEntry; | 24 struct GrantedFileEntry; |
23 } | 25 } |
24 | 26 |
25 class AppEventRouter { | 27 class AppEventRouter { |
26 public: | 28 public: |
27 // Dispatches the onLaunched event to the given app. | 29 // Dispatches the onLaunched event to the given app. |
28 static void DispatchOnLaunchedEvent(content::BrowserContext* context, | 30 static void DispatchOnLaunchedEvent(content::BrowserContext* context, |
29 const Extension* extension); | 31 const extensions::Extension* extension); |
30 | 32 |
31 // Dispatches the onRestarted event to the given app, providing a list of | 33 // Dispatches the onRestarted event to the given app, providing a list of |
32 // restored file entries from the previous run. | 34 // restored file entries from the previous run. |
33 static void DispatchOnRestartedEvent(content::BrowserContext* context, | 35 static void DispatchOnRestartedEvent(content::BrowserContext* context, |
34 const Extension* extension); | 36 const extensions::Extension* extension); |
35 | 37 |
36 // TODO(benwells): Update this comment, it is out of date. | 38 // TODO(benwells): Update this comment, it is out of date. |
37 // Dispatches the onLaunched event to the given app, providing launch data of | 39 // Dispatches the onLaunched event to the given app, providing launch data of |
38 // the form: | 40 // the form: |
39 // { | 41 // { |
40 // "intent" : { | 42 // "intent" : { |
41 // "type" : "chrome-extension://fileentry", | 43 // "type" : "chrome-extension://fileentry", |
42 // "data" : a FileEntry, | 44 // "data" : a FileEntry, |
43 // "postResults" : a null function, | 45 // "postResults" : a null function, |
44 // "postFailure" : a null function | 46 // "postFailure" : a null function |
45 // } | 47 // } |
46 // } | 48 // } |
47 | 49 |
48 // The FileEntry is created from |file_system_id| and |base_name|. | 50 // 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 | 51 // |handler_id| corresponds to the id of the file_handlers item in the |
50 // manifest that resulted in a match which triggered this launch. | 52 // manifest that resulted in a match which triggered this launch. |
51 static void DispatchOnLaunchedEventWithFileEntry( | 53 static void DispatchOnLaunchedEventWithFileEntry( |
52 content::BrowserContext* context, | 54 content::BrowserContext* context, |
53 const Extension* extension, | 55 const extensions::Extension* extension, |
54 const std::string& handler_id, | 56 const std::string& handler_id, |
55 const std::string& mime_type, | 57 const std::string& mime_type, |
56 const extensions::app_file_handler_util::GrantedFileEntry& file_entry); | 58 const file_handler_util::GrantedFileEntry& file_entry); |
57 | 59 |
58 // |handler_id| corresponds to the id of the url_handlers item | 60 // |handler_id| corresponds to the id of the url_handlers item |
59 // in the manifest that resulted in a match which triggered this launch. | 61 // in the manifest that resulted in a match which triggered this launch. |
60 static void DispatchOnLaunchedEventWithUrl(content::BrowserContext* context, | 62 static void DispatchOnLaunchedEventWithUrl( |
61 const Extension* extension, | 63 content::BrowserContext* context, |
62 const std::string& handler_id, | 64 const extensions::Extension* extension, |
63 const GURL& url, | 65 const std::string& handler_id, |
64 const GURL& referrer_url); | 66 const GURL& url, |
| 67 const GURL& referrer_url); |
65 }; | 68 }; |
66 | 69 |
67 } // namespace extensions | 70 } // namespace apps |
68 | 71 |
69 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 72 #endif // APPS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
OLD | NEW |