| 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. |
| 31 static void DispatchOnRestartedEvent(Profile* profile, | 34 static void DispatchOnRestartedEvent(Profile* profile, |
| 32 const Extension* extension); | 35 const Extension* extension); |
| 33 | 36 |
| 34 // TODO(benwells): Update this comment, it is out of date. | 37 // TODO(benwells): Update this comment, it is out of date. |
| 35 // Dispatches the onLaunched event to the given app, providing launch data of | 38 // Dispatches the onLaunched event to the given app, providing launch data of |
| 36 // the form: | 39 // the form: |
| 37 // { | 40 // { |
| 38 // "intent" : { | 41 // "intent" : { |
| 39 // "type" : "chrome-extension://fileentry", | 42 // "type" : "chrome-extension://fileentry", |
| 40 // "data" : a FileEntry, | 43 // "data" : a FileEntry, |
| 41 // "postResults" : a null function, | 44 // "postResults" : a null function, |
| 42 // "postFailure" : a null function | 45 // "postFailure" : a null function |
| 43 // } | 46 // } |
| 44 // } | 47 // } |
| 45 | 48 |
| 46 // launchData.intent.data and launchData.intent.postResults are created in a | 49 // The FileEntry is created from |file_system_id| and |base_name|. |
| 47 // custom dispatch event in javascript. The FileEntry is created from | 50 // |handler_id| corresponds to the id of the file_handlers item in the |
| 48 // |file_system_id| and |base_name|. | 51 // manifest that resulted in a match which triggered this launch. |
| 49 static void DispatchOnLaunchedEventWithFileEntry( | 52 static void DispatchOnLaunchedEventWithFileEntry( |
| 50 Profile* profile, | 53 Profile* profile, |
| 51 const Extension* extension, | 54 const Extension* extension, |
| 52 const std::string& handler_id, | 55 const std::string& handler_id, |
| 53 const std::string& mime_type, | 56 const std::string& mime_type, |
| 54 const extensions::app_file_handler_util::GrantedFileEntry& file_entry); | 57 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); |
| 55 }; | 67 }; |
| 56 | 68 |
| 57 } // namespace extensions | 69 } // namespace extensions |
| 58 | 70 |
| 59 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 71 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
| OLD | NEW |