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

Unified Diff: components/translate/content/browser/browser_cld_data_provider_factory.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: Rebase and merge Created 6 years, 3 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_factory.h
diff --git a/components/translate/content/browser/browser_cld_data_provider_factory.h b/components/translate/content/browser/browser_cld_data_provider_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..d41d0c7aee163aa261afb632f144611bec7a3b84
--- /dev/null
+++ b/components/translate/content/browser/browser_cld_data_provider_factory.h
@@ -0,0 +1,40 @@
+// 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_DATA_PROVIDER_FACTORY_H_
+#define COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_FACTORY_H_
+
+#include "components/translate/content/browser/browser_cld_data_provider.h"
+
+namespace content {
+class WebContents;
+}
+
+namespace translate {
+
+class BrowserCldDataProviderFactory {
Andrew Hayden (chromium.org) 2014/09/26 10:22:49 Needs comments.
Andrew Hayden (chromium.org) 2014/10/28 15:18:39 Done.
+ public:
+ BrowserCldDataProviderFactory();
+ virtual ~BrowserCldDataProviderFactory();
+ virtual BrowserCldDataProvider* NewProvider(
+ content::WebContents* web_contents);
+
+ // Returns true if and only if the current instance for this process is not
+ // NULL.
+ static bool IsInitialized();
+
+ // Sets the instance of the factory used by this process, optionally
+ // overwriting the previous value. Embedders and narrow use-cases (such as
+ // shells and test code) should use the overwrite capability, while generic
+ // code should not.
+ static void Set(BrowserCldDataProviderFactory* instance, bool overwrite);
+
+ // Returns the instance of the provider previously set by Set(...).
+ // If no instance has been set, a default no-op provider will be returned.
+ static BrowserCldDataProviderFactory* Get();
+};
+
+} // namespace translate
+
+#endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698