| 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_INTENTS_INTENT_SERVICE_HOST_H_ | |
| 6 #define CHROME_BROWSER_INTENTS_INTENT_SERVICE_HOST_H_ | |
| 7 | |
| 8 namespace content { | |
| 9 class WebIntentsDispatcher; | |
| 10 } | |
| 11 | |
| 12 namespace web_intents { | |
| 13 | |
| 14 // Interface for web intent "services" that act as handlers for | |
| 15 // web intents invoked by client code or other means. "services" can | |
| 16 // be implemented in a variety of means across different "host" environments | |
| 17 // Examples: | |
| 18 // * In another tab, where the tab hosts a web page that services the | |
| 19 // intent. | |
| 20 // * In the Chrome browser where a file picker can be used to select | |
| 21 // a file from disk in response to a "pick" action. | |
| 22 // * In the underlying OS where a native application could be used | |
| 23 // to handle an intent. | |
| 24 // | |
| 25 // A "service" is selected by policy, based on a heuristic including: | |
| 26 // user selection, system defaults, declaration as an "explicit" intent | |
| 27 // by client code, and other means. This selection process is managed | |
| 28 // by WebInentPickerController. | |
| 29 // | |
| 30 // A service, once selected, is responsible for responding to an intent. | |
| 31 // The "intent" is presented to the service as an instance of | |
| 32 // WebIntentsDispatcher. The dispatcher provides access to the intent data | |
| 33 // in the form of a webkit_glue::WebIntentData. The dispatcher also provides | |
| 34 // the service a means of responding to the intent. | |
| 35 // | |
| 36 // A service instance is owned by WebIntentPickerController. Its lifetime is a | |
| 37 // subset of the life of an intent. It will be created immediately prior | |
| 38 // to calling HandleIntent, and destroyed immediately after SendReply | |
| 39 // is called. | |
| 40 // | |
| 41 // For details see content::WebIntentsDispatcher and webkit_glue::WebIntentData | |
| 42 class IntentServiceHost { | |
| 43 public: | |
| 44 virtual ~IntentServiceHost() {} | |
| 45 | |
| 46 // A service is responsible for replying to the dispatcher in all | |
| 47 // circumstances, including when the user has canceled the operation, | |
| 48 // or the action was terminated without user intervention. In each of | |
| 49 // these cases the correct webkit_glue::WebIntentReplyType should | |
| 50 // be chosen and a response should be delivered to the dispatcher | |
| 51 // via SendReply(webkit_glue::WebIntentReply). | |
| 52 virtual void HandleIntent(content::WebIntentsDispatcher* dispatcher) = 0; | |
| 53 }; | |
| 54 | |
| 55 } // namespace web_intents | |
| 56 | |
| 57 #endif // CHROME_BROWSER_INTENTS_INTENT_SERVICE_HOST_H_ | |
| OLD | NEW |