| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_INTENTS_NATIVE_SERVICES_H_ | 5 #ifndef CHROME_BROWSER_INTENTS_NATIVE_SERVICES_H_ |
| 6 #define CHROME_BROWSER_INTENTS_NATIVE_SERVICES_H_ | 6 #define CHROME_BROWSER_INTENTS_NATIVE_SERVICES_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 | 11 |
| 12 class GURL; | 12 class GURL; |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 class WebContents; |
| 15 class WebIntentsDispatcher; | 16 class WebIntentsDispatcher; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace webkit_glue { | 19 namespace webkit_glue { |
| 19 struct WebIntentData; | 20 struct WebIntentData; |
| 20 struct WebIntentServiceData; | 21 struct WebIntentServiceData; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace web_intents { | 24 namespace web_intents { |
| 24 | 25 |
| 25 class IntentServiceHost; | 26 class IntentServiceHost; |
| 26 | 27 |
| 27 extern const char kChromeNativeSerivceScheme[]; | 28 extern const char kChromeNativeSerivceScheme[]; |
| 28 extern const char kNativeFilePickerUrl[]; | 29 extern const char kNativeFilePickerUrl[]; |
| 29 | 30 |
| 30 typedef std::vector<webkit_glue::WebIntentServiceData> IntentServiceList; | 31 typedef std::vector<webkit_glue::WebIntentServiceData> IntentServiceList; |
| 31 | 32 |
| 32 #if defined(TOOLKIT_VIEWS) | 33 #if !defined(ANDROID) |
| 33 // Factory capable of producing a file picker NativeService. | 34 // Factory capable of producing a file picker NativeService. |
| 34 class FilePickerFactory { | 35 class FilePickerFactory { |
| 35 public: | 36 public: |
| 36 // Returns a localized title for the file picker. | 37 // Returns a localized title for the file picker. |
| 37 static string16 GetServiceTitle(); | 38 static string16 GetServiceTitle(); |
| 38 | 39 |
| 39 // Returns a new instance of FilePickerService. | 40 // Returns a new instance of FilePickerService. |
| 40 static IntentServiceHost* CreateServiceInstance( | 41 static IntentServiceHost* CreateServiceInstance( |
| 41 const webkit_glue::WebIntentData& intent); | 42 const webkit_glue::WebIntentData& intent, |
| 43 content::WebContents* web_contents); |
| 44 |
| 42 DISALLOW_COPY_AND_ASSIGN(FilePickerFactory); | 45 DISALLOW_COPY_AND_ASSIGN(FilePickerFactory); |
| 43 }; | 46 }; |
| 44 #endif | 47 #endif |
| 45 | 48 |
| 46 class NativeServiceRegistry { | 49 class NativeServiceRegistry { |
| 47 public: | 50 public: |
| 48 NativeServiceRegistry(); | 51 NativeServiceRegistry(); |
| 49 // Populates |services| with all supported native services. | 52 // Populates |services| with all supported native services. |
| 50 void GetSupportedServices( | 53 void GetSupportedServices( |
| 51 const string16& action, | 54 const string16& action, |
| 52 IntentServiceList* services); | 55 IntentServiceList* services); |
| 56 |
| 53 DISALLOW_COPY_AND_ASSIGN(NativeServiceRegistry); | 57 DISALLOW_COPY_AND_ASSIGN(NativeServiceRegistry); |
| 54 }; | 58 }; |
| 55 | 59 |
| 56 class NativeServiceFactory { | 60 class NativeServiceFactory { |
| 57 public: | 61 public: |
| 58 NativeServiceFactory(); | 62 NativeServiceFactory(); |
| 59 // Returns a NativeService instance suitable to handle | 63 // Returns a NativeService instance suitable to handle |intent|. |
| 60 // |intent|. | 64 // |url| identifies the service to be instantiated, and |web_contents| |
| 65 // is the web_contents that may be be needed to serve as host environment |
| 66 // to the service. |
| 61 IntentServiceHost* CreateServiceInstance( | 67 IntentServiceHost* CreateServiceInstance( |
| 62 const GURL& url, | 68 const GURL& url, |
| 63 const webkit_glue::WebIntentData& intent); | 69 const webkit_glue::WebIntentData& intent, |
| 70 content::WebContents* web_contents); |
| 71 |
| 64 DISALLOW_COPY_AND_ASSIGN(NativeServiceFactory); | 72 DISALLOW_COPY_AND_ASSIGN(NativeServiceFactory); |
| 65 }; | 73 }; |
| 66 | 74 |
| 67 } // web_intents namespaces | 75 } // web_intents namespaces |
| 68 | 76 |
| 69 #endif // CHROME_BROWSER_INTENTS_NATIVE_SERVICES_H_ | 77 #endif // CHROME_BROWSER_INTENTS_NATIVE_SERVICES_H_ |
| OLD | NEW |