| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 class GURL; | |
| 11 | |
| 12 namespace content { | |
| 13 class BrowserContext; | |
| 14 class WebContents; | |
| 15 } | |
| 16 | |
| 17 namespace extensions { | |
| 18 | |
| 19 class Extension; | |
| 20 | |
| 21 namespace app_file_handler_util { | |
| 22 struct GrantedFileEntry; | |
| 23 } | |
| 24 | |
| 25 class AppEventRouter { | |
| 26 public: | |
| 27 // Dispatches the onLaunched event to the given app. | |
| 28 static void DispatchOnLaunchedEvent(content::BrowserContext* context, | |
| 29 const Extension* extension); | |
| 30 | |
| 31 // Dispatches the onRestarted event to the given app, providing a list of | |
| 32 // restored file entries from the previous run. | |
| 33 static void DispatchOnRestartedEvent(content::BrowserContext* context, | |
| 34 const Extension* extension); | |
| 35 | |
| 36 // TODO(benwells): Update this comment, it is out of date. | |
| 37 // Dispatches the onLaunched event to the given app, providing launch data of | |
| 38 // the form: | |
| 39 // { | |
| 40 // "intent" : { | |
| 41 // "type" : "chrome-extension://fileentry", | |
| 42 // "data" : a FileEntry, | |
| 43 // "postResults" : a null function, | |
| 44 // "postFailure" : a null function | |
| 45 // } | |
| 46 // } | |
| 47 | |
| 48 // The FileEntry is created from |file_system_id| and |base_name|. | |
| 49 // |handler_id| corresponds to the id of the file_handlers item in the | |
| 50 // manifest that resulted in a match which triggered this launch. | |
| 51 static void DispatchOnLaunchedEventWithFileEntry( | |
| 52 content::BrowserContext* context, | |
| 53 const Extension* extension, | |
| 54 const std::string& handler_id, | |
| 55 const std::string& mime_type, | |
| 56 const extensions::app_file_handler_util::GrantedFileEntry& file_entry); | |
| 57 | |
| 58 // |handler_id| corresponds to the id of the url_handlers item | |
| 59 // in the manifest that resulted in a match which triggered this launch. | |
| 60 static void DispatchOnLaunchedEventWithUrl(content::BrowserContext* context, | |
| 61 const Extension* extension, | |
| 62 const std::string& handler_id, | |
| 63 const GURL& url, | |
| 64 const GURL& referrer_url); | |
| 65 }; | |
| 66 | |
| 67 } // namespace extensions | |
| 68 | |
| 69 #endif // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_ | |
| OLD | NEW |