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

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: 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_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..bf6477672d45755ef1b867eca99e935e02fb0b11
--- /dev/null
+++ b/components/translate/content/browser/browser_cld_data_provider_factory.h
@@ -0,0 +1,42 @@
+// 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 {
+ public:
+ BrowserCldDataProviderFactory();
+ virtual ~BrowserCldDataProviderFactory();
+ virtual BrowserCldDataProvider* NewProvider(
jochen (gone - plz use gerrit) 2014/10/23 13:57:39 nit. empty line above this one
Andrew Hayden (chromium.org) 2014/10/30 16:56:32 Done and comments added too.
+ 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();
+
+ // TODO(andrewhayden) reuse pattern used in CldDataSource: NONE, STATIC, ...
+};
jochen (gone - plz use gerrit) 2014/10/23 13:57:39 disallow copy/assign
Andrew Hayden (chromium.org) 2014/10/30 16:56:32 Done.
+
+} // namespace translate
+
+#endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698