Home | History | Annotate | Download | only in app_runtime
      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 "base/strings/string16.h"
      9 #include "chrome/browser/extensions/extension_function.h"
     10 
     11 class Profile;
     12 
     13 namespace content {
     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, providing no launch
     28   // data.
     29   static void DispatchOnLaunchedEvent(Profile* profile,
     30                                       const Extension* extension);
     31   static void DispatchOnRestartedEvent(Profile* profile,
     32                                        const Extension* extension);
     33 
     34   // TODO(benwells): Update this comment, it is out of date.
     35   // Dispatches the onLaunched event to the given app, providing launch data of
     36   // the form:
     37   // {
     38   //   "intent" : {
     39   //     "type" : "chrome-extension://fileentry",
     40   //     "data" : a FileEntry,
     41   //     "postResults" : a null function,
     42   //     "postFailure" : a null function
     43   //   }
     44   // }
     45 
     46   // launchData.intent.data and launchData.intent.postResults are created in a
     47   // custom dispatch event in javascript. The FileEntry is created from
     48   // |file_system_id| and |base_name|.
     49   static void DispatchOnLaunchedEventWithFileEntry(
     50       Profile* profile,
     51       const Extension* extension,
     52       const std::string& handler_id,
     53       const std::string& mime_type,
     54       const extensions::app_file_handler_util::GrantedFileEntry& file_entry);
     55 };
     56 
     57 }  // namespace extensions
     58 
     59 #endif  // CHROME_BROWSER_EXTENSIONS_API_APP_RUNTIME_APP_RUNTIME_API_H_
     60