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 CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
7 | 7 |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace app_file_handler_util { | 21 namespace app_file_handler_util { |
22 struct GrantedFileEntry; | 22 struct GrantedFileEntry; |
23 } | 23 } |
24 | 24 |
25 class AppEventRouter { | 25 class AppEventRouter { |
26 public: | 26 public: |
27 // Dispatches the onLaunched event to the given app, providing no launch | 27 // Dispatches the onLaunched event to the given app, providing no launch |
28 // data. | 28 // data. |
29 static void DispatchOnLaunchedEvent(Profile* profile, | 29 static void DispatchOnLaunchedEvent(Profile* profile, |
30 const Extension* extension); | 30 const Extension* extension); |
31 | |
32 // Dispatches the onRestarted event to the given app, providing a list of | |
33 // restored file entries from the previous run. | |
34 static void DispatchOnRestartedEvent(Profile* profile, | 31 static void DispatchOnRestartedEvent(Profile* profile, |
35 const Extension* extension); | 32 const Extension* extension); |
36 | 33 |
37 // TODO(benwells): Update this comment, it is out of date. | 34 // TODO(benwells): Update this comment, it is out of date. |
38 // Dispatches the onLaunched event to the given app, providing launch data of | 35 // Dispatches the onLaunched event to the given app, providing launch data of |
39 // the form: | 36 // the form: |
40 // { | 37 // { |
41 // "intent" : { | 38 // "intent" : { |
42 // "type" : "chrome-extension://fileentry", | 39 // "type" : "chrome-extension://fileentry", |
43 // "data" : a FileEntry, | 40 // "data" : a FileEntry, |
44 // "postResults" : a null function, | 41 // "postResults" : a null function, |
45 // "postFailure" : a null function | 42 // "postFailure" : a null function |
46 // } | 43 // } |
47 // } | 44 // } |
48 | 45 |
49 // The FileEntry is created from |file_system_id| and |base_name|. | 46 // launchData.intent.data and launchData.intent.postResults are created in a |
50 // |handler_id| corresponds to the id of the file_handlers item in the | 47 // custom dispatch event in javascript. The FileEntry is created from |
51 // manifest that resulted in a match which triggered this launch. | 48 // |file_system_id| and |base_name|. |
52 static void DispatchOnLaunchedEventWithFileEntry( | 49 static void DispatchOnLaunchedEventWithFileEntry( |
53 Profile* profile, | 50 Profile* profile, |
54 const Extension* extension, | 51 const Extension* extension, |
55 const std::string& handler_id, | 52 const std::string& handler_id, |
56 const std::string& mime_type, | 53 const std::string& mime_type, |
57 const extensions::app_file_handler_util::GrantedFileEntry& file_entry); | 54 const extensions::app_file_handler_util::GrantedFileEntry& file_entry); |
58 | |
59 // |handler_id| corresponds to the id of the url_handlers item | |
60 // in the manifest that resulted in a match which triggered this launch. | |
61 static void DispatchOnLaunchedEventWithUrl( | |
62 Profile* profile, | |
63 const Extension* extension, | |
64 const std::string& handler_id, | |
65 const GURL& url, | |
66 const GURL& referrer_url); | |
67 }; | 55 }; |
68 | 56 |
69 } // namespace extensions | 57 } // namespace extensions |
70 | 58 |
71 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 59 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
OLD | NEW |