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/string16.h" | 8 #include "base/string16.h" |
9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
10 | 10 |
11 class Profile; | 11 class Profile; |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class WebContents; | 14 class WebContents; |
15 class WebIntentsDispatcher; | |
16 } | 15 } |
17 | 16 |
18 namespace extensions { | 17 namespace extensions { |
19 | 18 |
20 class Extension; | 19 class Extension; |
21 | 20 |
22 class AppEventRouter { | 21 class AppEventRouter { |
23 public: | 22 public: |
24 // Dispatches the onLaunched event to the given app, providing no launch | 23 // Dispatches the onLaunched event to the given app, providing no launch |
25 // data. | 24 // data. |
26 static void DispatchOnLaunchedEvent(Profile* profile, | 25 static void DispatchOnLaunchedEvent(Profile* profile, |
27 const Extension* extension); | 26 const Extension* extension); |
28 static void DispatchOnRestartedEvent(Profile* profile, | 27 static void DispatchOnRestartedEvent(Profile* profile, |
29 const Extension* extension); | 28 const Extension* extension); |
30 | 29 |
31 // Dispatches the onLaunched event to the given app, providing launch data of | 30 // Dispatches the onLaunched event to the given app, providing launch data of |
benwells
2013/02/07 06:00:03
Please add a TODO here on me to update this commen
Nico
2013/02/07 06:20:23
Done.
| |
32 // the form: | 31 // the form: |
33 // { | 32 // { |
34 // "intent" : { | 33 // "intent" : { |
35 // "action" : |action|, | |
36 // "type" : "chrome-extension://fileentry", | 34 // "type" : "chrome-extension://fileentry", |
37 // "data" : a FileEntry, | 35 // "data" : a FileEntry, |
38 // "postResults" : a null function, | 36 // "postResults" : a null function, |
39 // "postFailure" : a null function | 37 // "postFailure" : a null function |
40 // } | 38 // } |
41 // } | 39 // } |
42 | 40 |
43 // launchData.intent.data and launchData.intent.postResults are created in a | 41 // launchData.intent.data and launchData.intent.postResults are created in a |
44 // custom dispatch event in javascript. The FileEntry is created from | 42 // custom dispatch event in javascript. The FileEntry is created from |
45 // |file_system_id| and |base_name|. | 43 // |file_system_id| and |base_name|. |
46 static void DispatchOnLaunchedEventWithFileEntry( | 44 static void DispatchOnLaunchedEventWithFileEntry( |
47 Profile* profile, | 45 Profile* profile, |
48 const Extension* extension, | 46 const Extension* extension, |
49 const string16& action, | |
50 const std::string& handler_id, | 47 const std::string& handler_id, |
51 const std::string& mime_type, | 48 const std::string& mime_type, |
52 const std::string& file_system_id, | 49 const std::string& file_system_id, |
53 const std::string& base_name); | 50 const std::string& base_name); |
54 | |
55 // Dispatches the onLaunched event to the app implemented by |extension| | |
56 // running in |profile|. The event parameter launchData will have a field | |
57 // called intent, populated by |web_intent_data|. | |
58 static void DispatchOnLaunchedEventWithWebIntent( | |
59 Profile* profile, | |
60 const Extension* extension, | |
61 content::WebIntentsDispatcher* intents_dispatcher, | |
62 content::WebContents* source); | |
63 }; | 51 }; |
64 | 52 |
65 class AppRuntimePostIntentResponseFunction : public SyncExtensionFunction { | 53 class AppRuntimePostIntentResponseFunction : public SyncExtensionFunction { |
Nico
2013/02/07 05:25:36
This is still here because as far as I understand
benwells
2013/02/07 06:00:03
I don't think so, it should be removed.
Nico
2013/02/07 06:20:23
If I delete the class, I get this error:
gen/ch
benwells
2013/02/07 06:44:53
Yes you should delete that and the other intent st
Nico
2013/02/08 22:42:55
Done.
| |
66 public: | 54 public: |
67 DECLARE_EXTENSION_FUNCTION("app.runtime.postIntentResponse", | 55 DECLARE_EXTENSION_FUNCTION("app.runtime.postIntentResponse", |
68 APP_RUNTIME_POSTINTENTRESPONSE) | 56 APP_RUNTIME_POSTINTENTRESPONSE) |
69 | 57 |
70 protected: | 58 protected: |
71 virtual ~AppRuntimePostIntentResponseFunction() {} | 59 virtual ~AppRuntimePostIntentResponseFunction() {} |
72 virtual bool RunImpl() OVERRIDE; | 60 virtual bool RunImpl() OVERRIDE; |
73 }; | 61 }; |
74 | 62 |
75 } // namespace extensions | 63 } // namespace extensions |
76 | 64 |
77 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 65 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
OLD | NEW |