| 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 } | 15 } |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 class Extension; | 19 class Extension; |
| 20 | 20 |
| 21 namespace app_file_handler_util { |
| 22 class GrantedFileEntry; |
| 23 } |
| 24 |
| 21 class AppEventRouter { | 25 class AppEventRouter { |
| 22 public: | 26 public: |
| 23 // Dispatches the onLaunched event to the given app, providing no launch | 27 // Dispatches the onLaunched event to the given app, providing no launch |
| 24 // data. | 28 // data. |
| 25 static void DispatchOnLaunchedEvent(Profile* profile, | 29 static void DispatchOnLaunchedEvent(Profile* profile, |
| 26 const Extension* extension); | 30 const Extension* extension); |
| 27 static void DispatchOnRestartedEvent(Profile* profile, | 31 static void DispatchOnRestartedEvent( |
| 28 const Extension* extension); | 32 Profile* profile, |
| 33 const Extension* extension, |
| 34 const std::vector<app_file_handler_util::GrantedFileEntry>& file_entries); |
| 29 | 35 |
| 30 // TODO(benwells): Update this comment, it is out of date. | 36 // TODO(benwells): Update this comment, it is out of date. |
| 31 // Dispatches the onLaunched event to the given app, providing launch data of | 37 // Dispatches the onLaunched event to the given app, providing launch data of |
| 32 // the form: | 38 // the form: |
| 33 // { | 39 // { |
| 34 // "intent" : { | 40 // "intent" : { |
| 35 // "type" : "chrome-extension://fileentry", | 41 // "type" : "chrome-extension://fileentry", |
| 36 // "data" : a FileEntry, | 42 // "data" : a FileEntry, |
| 37 // "postResults" : a null function, | 43 // "postResults" : a null function, |
| 38 // "postFailure" : a null function | 44 // "postFailure" : a null function |
| 39 // } | 45 // } |
| 40 // } | 46 // } |
| 41 | 47 |
| 42 // launchData.intent.data and launchData.intent.postResults are created in a | 48 // launchData.intent.data and launchData.intent.postResults are created in a |
| 43 // custom dispatch event in javascript. The FileEntry is created from | 49 // custom dispatch event in javascript. The FileEntry is created from |
| 44 // |file_system_id| and |base_name|. | 50 // |file_system_id| and |base_name|. |
| 45 static void DispatchOnLaunchedEventWithFileEntry( | 51 static void DispatchOnLaunchedEventWithFileEntry( |
| 46 Profile* profile, | 52 Profile* profile, |
| 47 const Extension* extension, | 53 const Extension* extension, |
| 48 const std::string& handler_id, | 54 const std::string& handler_id, |
| 49 const std::string& mime_type, | 55 const std::string& mime_type, |
| 50 const std::string& file_system_id, | 56 const std::string& file_system_id, |
| 51 const std::string& base_name); | 57 const std::string& base_name); |
| 52 }; | 58 }; |
| 53 | 59 |
| 54 } // namespace extensions | 60 } // namespace extensions |
| 55 | 61 |
| 56 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 62 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
| OLD | NEW |