OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_TRANSLATE_CLD_DATA_HARNESS_FACTORY_H_ | |
6 #define CHROME_BROWSER_TRANSLATE_CLD_DATA_HARNESS_FACTORY_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "chrome/browser/translate/cld_data_harness.h" | |
11 | |
12 namespace test { | |
13 | |
14 // Testing class that allows embedders to inject an arbitrary CldDataHarness | |
15 // into the runtime by definining a subclass of CldDataHarnessFactory and | |
16 // setting the global instance of it with Set(CldDataHarnessFactory*). | |
17 // Chromium code should use the factory instance returned by Get() to obtain | |
18 // CldDataHarness instances. | |
19 class CldDataHarnessFactory { | |
20 public: | |
21 CldDataHarnessFactory() {} | |
22 virtual ~CldDataHarnessFactory() {} | |
23 | |
24 // Create a new CldDataHarness. | |
25 // The default implementation returns a simple CldDataHarness, which is | |
26 // likely to be incorrect for most non-static CLD use cases. | |
27 virtual scoped_ptr<CldDataHarness> CreateCldDataHarness(); | |
Takashi Toyoshima
2014/11/06 14:34:29
I feel Create() is enough good name for this since
Andrew Hayden (chromium.org)
2014/11/10 14:06:35
Please see my comments in browser_cld_data_provide
Takashi Toyoshima
2014/11/11 07:16:36
I see.
| |
28 | |
29 // Sets the CldDataHarnessFactory instance for the process. | |
30 static void Set(CldDataHarnessFactory* instance); | |
31 | |
32 // Returns the CldDataHarnessFactory instance previously set for the process. | |
33 static CldDataHarnessFactory* Get(); | |
34 | |
35 // Fetch the global instance of the "static" factory that produces a harness | |
36 // suitable for use with the "static" CLD data source. | |
37 static CldDataHarnessFactory* GetStaticDataHarnessFactory(); | |
38 | |
39 // Fetch the global instance of the "standalone" factory that produces a | |
40 // harness suitable for use with the "standalone" CLD data source. | |
41 static CldDataHarnessFactory* GetStandaloneDataHarnessFactory(); | |
42 | |
43 // Fetch the global instance of the "component" factory that produces a | |
44 // harness suitable for use with the "component" CLD data source. | |
45 static CldDataHarnessFactory* GetComponentDataHarnessFactory(); | |
46 | |
47 private: | |
48 DISALLOW_COPY_AND_ASSIGN(CldDataHarnessFactory); | |
49 }; | |
50 } // namespace test | |
51 | |
52 #endif // CHROME_BROWSER_TRANSLATE_CLD_DATA_HARNESS_FACTORY_H_ | |
OLD | NEW |