Index: components/translate/content/browser/browser_cld_data_provider.h |
diff --git a/components/translate/content/browser/browser_cld_data_provider.h b/components/translate/content/browser/browser_cld_data_provider.h |
index ce6022de6560d5de9f7461043eee2241266fb247..679e0e2f117f69e78107f54b38997e8ddd917b3a 100644 |
--- a/components/translate/content/browser/browser_cld_data_provider.h |
+++ b/components/translate/content/browser/browser_cld_data_provider.h |
@@ -5,6 +5,8 @@ |
#ifndef COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_ |
#define COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_ |
+#include <string> |
+ |
#include "ipc/ipc_listener.h" |
namespace IPC { |
@@ -59,6 +61,25 @@ class BrowserCldDataProvider : public IPC::Listener { |
BrowserCldDataProvider* CreateBrowserCldDataProviderFor( |
content::WebContents*); |
+// Allows passing an implementation-specific configuration object to the data |
+// source. Since it is not possible to know at compile time which data source |
+// is being linked into the runtime, there can be no specific data type other |
+// than a raw pointer. The caller retains ownership of the pointer (the |
+// implementation should make an independent copy of the data if necessary). |
+// |
+// The 'static' CLD data source implements this as a no-op. |
+// The 'component' and 'standalone' data sources implement this expecting a |
+// pointer to a base::FilePath representing the path to a CLD data file. |
+// Other data sources may implement this arbitrarily. |
+// |
+// This method is provided so that code living outside of the /components |
+// source tree can configure data sources without having to depend directly |
+// upon a specific implementation, greatly simplifying build logic and |
+// linking; the cost is type safety. Callers should first check the run-time |
+// type of CLD data source configured (via CldDataSource::GetName()) and |
+// ensure that the correct type of object is passed. |
jam
2014/07/29 19:51:27
this seems a bit odd and fragile. Can an abstract
|
+void ConfigureBrowserCldDataProvider(const void* config); |
+ |
} // namespace translate |
-#endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATAP_PROVIDER_H_ |
+#endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_ |