Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: components/translate/content/browser/browser_cld_data_provider.h

Issue 424053002: Add a new "Configure" mechanism to CLD browser-side data interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase now that dependencies have landed Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | components/translate/content/browser/data_file_browser_cld_data_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698