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_NATIVE_SERVICES_H_ | |
6 #define CHROME_BROWSER_INTENTS_NATIVE_SERVICES_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 #include "base/basictypes.h" | |
11 #include "base/string16.h" | |
12 | |
13 class GURL; | |
14 | |
15 namespace content { | |
16 class WebContents; | |
17 class WebIntentsDispatcher; | |
18 } | |
19 | |
20 namespace webkit_glue { | |
21 struct WebIntentData; | |
22 struct WebIntentServiceData; | |
23 } | |
24 | |
25 namespace web_intents { | |
26 | |
27 class IntentServiceHost; | |
28 | |
29 extern const char kChromeNativeSerivceScheme[]; | |
30 extern const char kNativeFilePickerUrl[]; | |
31 | |
32 typedef std::vector<webkit_glue::WebIntentServiceData> IntentServiceList; | |
33 | |
34 #if !defined(ANDROID) | |
35 // Factory capable of producing a native file picker IntentServiceHost, | |
36 // as well as producing registration information about the service. | |
37 class FilePickerFactory { | |
38 public: | |
39 // Returns a localized title for the file picker. | |
40 static string16 GetServiceTitle(); | |
41 | |
42 // Returns a new IntentServiceHost. The instance is owned by the caller. | |
43 // |intent| is the intent data. |web_contents| is the context in which | |
44 // the intent was invoked. | |
45 static IntentServiceHost* CreateServiceInstance( | |
46 const webkit_glue::WebIntentData& intent, | |
47 content::WebContents* web_contents); | |
48 | |
49 private: | |
50 DISALLOW_COPY_AND_ASSIGN(FilePickerFactory); | |
51 }; | |
52 #endif | |
53 | |
54 class NativeServiceRegistry { | |
55 public: | |
56 NativeServiceRegistry(); | |
57 // Populates |services| with all supported IntentServiceHosts | |
58 // capable of handling |action|. | |
59 void GetSupportedServices( | |
60 const string16& action, | |
61 IntentServiceList* services); | |
62 | |
63 private: | |
64 DISALLOW_COPY_AND_ASSIGN(NativeServiceRegistry); | |
65 }; | |
66 | |
67 class NativeServiceFactory { | |
68 public: | |
69 NativeServiceFactory(); | |
70 // Returns an IntentServiceHost instance suitable to handle |intent|. | |
71 // |url| identifies the service to be instantiated, |web_contents| is | |
72 // the web_contents of the client that invoked this intent. The | |
73 // IntentServiceHost is owned by the caller. | |
74 IntentServiceHost* CreateServiceInstance( | |
75 const GURL& url, | |
76 const webkit_glue::WebIntentData& intent, | |
77 content::WebContents* web_contents); | |
78 | |
79 private: | |
80 DISALLOW_COPY_AND_ASSIGN(NativeServiceFactory); | |
81 }; | |
82 | |
83 } // namespace web_intents | |
84 | |
85 #endif // CHROME_BROWSER_INTENTS_NATIVE_SERVICES_H_ | |
OLD | NEW |