| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
| 6 #define EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 6 #define EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/optional.h" |
| 12 #include "extensions/common/constants.h" | 13 #include "extensions/common/constants.h" |
| 13 | 14 |
| 14 class GURL; | 15 class GURL; |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class DictionaryValue; | 18 class DictionaryValue; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 class BrowserContext; | 22 class BrowserContext; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 32 public: | 33 public: |
| 33 // Dispatches the onEmbedRequested event to the given app. | 34 // Dispatches the onEmbedRequested event to the given app. |
| 34 static void DispatchOnEmbedRequestedEvent( | 35 static void DispatchOnEmbedRequestedEvent( |
| 35 content::BrowserContext* context, | 36 content::BrowserContext* context, |
| 36 std::unique_ptr<base::DictionaryValue> app_embedding_request_data, | 37 std::unique_ptr<base::DictionaryValue> app_embedding_request_data, |
| 37 const extensions::Extension* extension); | 38 const extensions::Extension* extension); |
| 38 | 39 |
| 39 // Dispatches the onLaunched event to the given app. | 40 // Dispatches the onLaunched event to the given app. |
| 40 static void DispatchOnLaunchedEvent(content::BrowserContext* context, | 41 static void DispatchOnLaunchedEvent(content::BrowserContext* context, |
| 41 const Extension* extension, | 42 const Extension* extension, |
| 42 extensions::AppLaunchSource source); | 43 extensions::AppLaunchSource source, |
| 44 base::Optional<ActionData> action_data); |
| 43 | 45 |
| 44 // Dispatches the onRestarted event to the given app, providing a list of | 46 // Dispatches the onRestarted event to the given app, providing a list of |
| 45 // restored file entries from the previous run. | 47 // restored file entries from the previous run. |
| 46 static void DispatchOnRestartedEvent(content::BrowserContext* context, | 48 static void DispatchOnRestartedEvent(content::BrowserContext* context, |
| 47 const Extension* extension); | 49 const Extension* extension); |
| 48 | 50 |
| 49 // TODO(benwells): Update this comment, it is out of date. | 51 // TODO(benwells): Update this comment, it is out of date. |
| 50 // Dispatches the onLaunched event to the given app, providing launch data of | 52 // Dispatches the onLaunched event to the given app, providing launch data of |
| 51 // the form: | 53 // the form: |
| 52 // { | 54 // { |
| 53 // "intent" : { | 55 // "intent" : { |
| 54 // "type" : "chrome-extension://fileentry", | 56 // "type" : "chrome-extension://fileentry", |
| 55 // "data" : a FileEntry, | 57 // "data" : a FileEntry, |
| 56 // "postResults" : a null function, | 58 // "postResults" : a null function, |
| 57 // "postFailure" : a null function | 59 // "postFailure" : a null function |
| 58 // } | 60 // } |
| 59 // } | 61 // } |
| 60 | 62 |
| 61 // The FileEntries are created from |file_system_id| and |base_name|. | 63 // The FileEntries are created from |file_system_id| and |base_name|. |
| 62 // |handler_id| corresponds to the id of the file_handlers item in the | 64 // |handler_id| corresponds to the id of the file_handlers item in the |
| 63 // manifest that resulted in a match which triggered this launch. | 65 // manifest that resulted in a match which triggered this launch. |
| 64 static void DispatchOnLaunchedEventWithFileEntries( | 66 static void DispatchOnLaunchedEventWithFileEntries( |
| 65 content::BrowserContext* context, | 67 content::BrowserContext* context, |
| 66 const Extension* extension, | 68 const Extension* extension, |
| 69 extensions::AppLaunchSource source, |
| 67 const std::string& handler_id, | 70 const std::string& handler_id, |
| 68 const std::vector<EntryInfo>& entries, | 71 const std::vector<EntryInfo>& entries, |
| 69 const std::vector<GrantedFileEntry>& file_entries); | 72 const std::vector<GrantedFileEntry>& file_entries, |
| 73 base::Optional<ActionData> action_data); |
| 70 | 74 |
| 71 // |handler_id| corresponds to the id of the url_handlers item | 75 // |handler_id| corresponds to the id of the url_handlers item |
| 72 // in the manifest that resulted in a match which triggered this launch. | 76 // in the manifest that resulted in a match which triggered this launch. |
| 73 static void DispatchOnLaunchedEventWithUrl(content::BrowserContext* context, | 77 static void DispatchOnLaunchedEventWithUrl(content::BrowserContext* context, |
| 74 const Extension* extension, | 78 const Extension* extension, |
| 75 const std::string& handler_id, | 79 const std::string& handler_id, |
| 76 const GURL& url, | 80 const GURL& url, |
| 77 const GURL& referrer_url); | 81 const GURL& referrer_url); |
| 78 }; | 82 }; |
| 79 | 83 |
| 80 } // namespace extensions | 84 } // namespace extensions |
| 81 | 85 |
| 82 #endif // EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ | 86 #endif // EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_ |
| OLD | NEW |