| 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..29d19718f06ceda4953f16c8b1d0e67e95400cfa
|
| --- /dev/null
|
| +++ b/chrome/browser/translate/cld_data_harness_factory.h
|
| @@ -0,0 +1,52 @@
|
| +// 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 {
|
| +
|
| +// Testing class that allows embedders to inject an arbitrary CldDataHarness
|
| +// into the runtime by definining a subclass of CldDataHarnessFactory and
|
| +// setting the global instance of it with Set(CldDataHarnessFactory*).
|
| +// Chromium code should use the factory instance returned by Get() to obtain
|
| +// CldDataHarness instances.
|
| +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 "static" factory that produces a harness
|
| + // suitable for use with the "static" CLD data source.
|
| + static CldDataHarnessFactory* GetStaticDataHarnessFactory();
|
| +
|
| + // Fetch the global instance of the "standalone" factory that produces a
|
| + // harness suitable for use with the "standalone" CLD data source.
|
| + static CldDataHarnessFactory* GetStandaloneDataHarnessFactory();
|
| +
|
| + // Fetch the global instance of the "component" factory that produces a
|
| + // harness suitable for use with the "component" CLD data source.
|
| + static CldDataHarnessFactory* GetComponentDataHarnessFactory();
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(CldDataHarnessFactory);
|
| +};
|
| +} // namespace test
|
| +
|
| +#endif // CHROME_BROWSER_TRANSLATE_CLD_DATA_HARNESS_FACTORY_H_
|
|
|