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

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

Issue 461633002: Refactor language detection logic to allow non-static CLD data sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge error in chrome/browser/BUILD.gn Created 6 years, 2 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_utils.h
diff --git a/components/translate/content/browser/browser_cld_utils.h b/components/translate/content/browser/browser_cld_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..1182c7b6abe103d1a7b5492c979f628552f90e82
--- /dev/null
+++ b/components/translate/content/browser/browser_cld_utils.h
@@ -0,0 +1,38 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_UTILS_H_
+#define COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_UTILS_H_
+
+namespace translate {
+
+// Browser-side utilities for dealing with CLD data source configuration.
+// This class exists primarily to avoid duplicating code in high-level targets
+// such as the Chrome browser, Chrome shell, and so on.
+class BrowserCldUtils {
+ public:
+ // Perform conditional configuration of the CLD data provider.
+ // If no specific BrowserCldDataProviderFactory has yet been set, an instance
+ // is created and assigned as appropriate for each platform. If a specific
+ // BrowserCldDataProviderFactory *has* been set, this method does nothing
+ // (as a side effect of setting the default factory, subsequent invocations
+ // do nothing - making this method reentrant).
+ //
+ // This method will not overwrite a data provider configured by an embedder,
+ //
+ // Maintainers: This is the default data source. It is appropriate to
+ // ifdef this code and customize the default per-platform. This method must
+ // be invoked prior to registering components with the component updater if
+ // the component updater implementation is to be used; it is best to ensure
+ // that this method is called as early as possible.
+ static void ConfigureDefaultDataProvider();
+
+ private:
+ BrowserCldUtils() {};
+ ~BrowserCldUtils() {};
jochen (gone - plz use gerrit) 2014/10/23 13:57:39 use a namespace instead of a class (and if it's a
Andrew Hayden (chromium.org) 2014/10/30 16:56:32 I'm fine with changing this to a namespace and a s
+};
+
+} // namespace translate
+
+#endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698