| 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 | 
|  | 30   // TODO(benwells): Update this comment, it is out of date. | 
| 31   // Dispatches the onLaunched event to the given app, providing launch data of | 31   // Dispatches the onLaunched event to the given app, providing launch data of | 
| 32   // the form: | 32   // the form: | 
| 33   // { | 33   // { | 
| 34   //   "intent" : { | 34   //   "intent" : { | 
| 35   //     "action" : |action|, |  | 
| 36   //     "type" : "chrome-extension://fileentry", | 35   //     "type" : "chrome-extension://fileentry", | 
| 37   //     "data" : a FileEntry, | 36   //     "data" : a FileEntry, | 
| 38   //     "postResults" : a null function, | 37   //     "postResults" : a null function, | 
| 39   //     "postFailure" : a null function | 38   //     "postFailure" : a null function | 
| 40   //   } | 39   //   } | 
| 41   // } | 40   // } | 
| 42 | 41 | 
| 43   // launchData.intent.data and launchData.intent.postResults are created in a | 42   // launchData.intent.data and launchData.intent.postResults are created in a | 
| 44   // custom dispatch event in javascript. The FileEntry is created from | 43   // custom dispatch event in javascript. The FileEntry is created from | 
| 45   // |file_system_id| and |base_name|. | 44   // |file_system_id| and |base_name|. | 
| 46   static void DispatchOnLaunchedEventWithFileEntry( | 45   static void DispatchOnLaunchedEventWithFileEntry( | 
| 47       Profile* profile, | 46       Profile* profile, | 
| 48       const Extension* extension, | 47       const Extension* extension, | 
| 49       const string16& action, |  | 
| 50       const std::string& handler_id, | 48       const std::string& handler_id, | 
| 51       const std::string& mime_type, | 49       const std::string& mime_type, | 
| 52       const std::string& file_system_id, | 50       const std::string& file_system_id, | 
| 53       const std::string& base_name); | 51       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 }; |  | 
| 64 |  | 
| 65 class AppRuntimePostIntentResponseFunction : public SyncExtensionFunction { |  | 
| 66  public: |  | 
| 67   DECLARE_EXTENSION_FUNCTION("app.runtime.postIntentResponse", |  | 
| 68                              APP_RUNTIME_POSTINTENTRESPONSE) |  | 
| 69 |  | 
| 70  protected: |  | 
| 71   virtual ~AppRuntimePostIntentResponseFunction() {} |  | 
| 72   virtual bool RunImpl() OVERRIDE; |  | 
| 73 }; | 52 }; | 
| 74 | 53 | 
| 75 }  // namespace extensions | 54 }  // namespace extensions | 
| 76 | 55 | 
| 77 #endif  // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 56 #endif  // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 
| OLD | NEW | 
|---|