OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_TRANSLATE_CONTENT_COMMON_CLD_DATA_SOURCE_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CONTENT_COMMON_CLD_DATA_SOURCE_H_ |
6 #define COMPONENTS_TRANSLATE_CONTENT_COMMON_CLD_DATA_SOURCE_H_ | 6 #define COMPONENTS_TRANSLATE_CONTENT_COMMON_CLD_DATA_SOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 namespace translate { | 10 namespace translate { |
11 | 11 |
12 // Provides high-level functionality related to a CLD Data Source. | 12 // Provides high-level functionality related to a CLD Data Source. |
13 class CldDataSource { | 13 class CldDataSource { |
14 | 14 |
15 public: | 15 public: |
16 | 16 |
17 // Returns the symbolic name of the data source. In the Chromium | 17 // Returns the symbolic name of the data source. In the Chromium |
18 // open-source tree, the following data sources exist: | 18 // open-source tree, the following data sources exist: |
19 // static uses the static_[browser|renderer]_cld_data_provider | 19 // static uses the static_[browser|renderer]_cld_data_provider |
20 // implementations. | 20 // implementations. |
21 // standalone uses the data_file_[browser|renderer]_cld_data_provider | 21 // standalone uses the data_file_[browser|renderer]_cld_data_provider |
22 // implementations. | 22 // implementations. |
23 // component also uses the data_file_[browser|renderer]_cld_data_provider | 23 // component also uses the data_file_[browser|renderer]_cld_data_provider |
24 // implementations. | 24 // implementations. |
25 // | 25 // |
26 // Other implementations based upon Chromium may provide CLD differently and | 26 // Other implementations based upon Chromium may provide CLD differently and |
27 // may have other names. | 27 // may have other names. This method is primarily provided for those |
| 28 // non-Chromium implementations; Chromium implementations should use the |
| 29 // boolean methods in this class instead: |
| 30 // ShouldRegisterForComponentUpdates() |
| 31 // ShouldUseStandaloneDataFile() |
28 static std::string GetName(); | 32 static std::string GetName(); |
29 | 33 |
| 34 // Returns true if the data source needs to receive updates from the |
| 35 // Component Updater. |
| 36 // This is only true if the data source name is "component", but makes caller |
| 37 // logic more generic. |
| 38 static bool ShouldRegisterForComponentUpdates(); |
| 39 |
| 40 // Returns true if the data source needs to have the path to the CLD |
| 41 // data file configured immediately because it is bundled with Chromium. |
| 42 // This is only true if the data source name is "standalone", but makes |
| 43 // caller logic more generic. |
| 44 static bool ShouldUseStandaloneDataFile(); |
30 }; | 45 }; |
31 | 46 |
32 } // namespace translate | 47 } // namespace translate |
33 #endif // COMPONENTS_TRANSLATE_CONTENT_COMMON_CLD_DATA_SOURCE_H_ | 48 #endif // COMPONENTS_TRANSLATE_CONTENT_COMMON_CLD_DATA_SOURCE_H_ |
OLD | NEW |