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

Unified Diff: chrome/browser/translate/cld_data_harness_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: chrome/browser/translate/cld_data_harness_factory.h
diff --git a/chrome/browser/translate/cld_data_harness_factory.h b/chrome/browser/translate/cld_data_harness_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..3bcc15211a428746fc788943652bbbda29c3e0f2
--- /dev/null
+++ b/chrome/browser/translate/cld_data_harness_factory.h
@@ -0,0 +1,48 @@
+// 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 CHROME_BROWSER_TRANSLATE_CLD_DATA_HARNESS_FACTORY_H_
+#define CHROME_BROWSER_TRANSLATE_CLD_DATA_HARNESS_FACTORY_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/translate/cld_data_harness.h"
+
+namespace test {
+
+class CldDataHarnessFactory {
+ public:
+ CldDataHarnessFactory();
+ virtual ~CldDataHarnessFactory();
+
+ // Create a new CldDataHarness.
+ // The default implementation returns a simple CldDataHarness, which is
+ // likely to be incorrect for most non-static CLD use cases.
+ virtual scoped_ptr<CldDataHarness> CreateCldDataHarness();
+
+ // Sets the CldDataHarnessFactory instance for the process.
+ static void Set(CldDataHarnessFactory* instance);
+
+ // Returns the CldDataHarnessFactory instance previously set for the process.
+ static CldDataHarnessFactory* Get();
+
+ // Fetch the global instance of the "none" factory that produces a harness
+ // suitable for use with the "none" CLD data source.
+ static CldDataHarnessFactory* NONE();
jam 2014/10/21 16:49:42 this name doesn't confirm to google style guide w
Andrew Hayden (chromium.org) 2014/10/30 16:56:32 I fixed the names and got rid of "NONE". The point
+
+ // Fetch the global instance of the "static" factory that produces a harness
+ // suitable for use with the "static" CLD data source.
+ static CldDataHarnessFactory* STATIC();
+
+ // Fetch the global instance of the "standalone" factory that produces a
+ // harness suitable for use with the "standalone" CLD data source.
+ static CldDataHarnessFactory* STANDALONE();
+
+ // Fetch the global instance of the "component" factory that produces a
+ // harness suitable for use with the "component" CLD data source.
+ static CldDataHarnessFactory* COMPONENT();
Takashi Toyoshima 2014/10/15 08:45:07 DISALLOW_COPY_AND_ASSIGN
Andrew Hayden (chromium.org) 2014/10/30 16:56:32 Done.
+};
+} // namespace test
+
+#endif // CHROME_BROWSER_TRANSLATE_CLD_DATA_HARNESS_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698