summaryrefslogtreecommitdiffstats
path: root/components/translate
diff options
context:
space:
mode:
authorandrewhayden@chromium.org <andrewhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-30 11:56:26 +0000
committerandrewhayden@chromium.org <andrewhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-30 11:56:26 +0000
commit3cb7c2b55cfa24ae40cd49a1d8fd15275b55dd0b (patch)
treeaf77160cb2faad51612d5bd950154e924be1a3ba /components/translate
parent77344cd910e3297713903431518a5f3cb154695c (diff)
downloadchromium_src-3cb7c2b55cfa24ae40cd49a1d8fd15275b55dd0b.zip
chromium_src-3cb7c2b55cfa24ae40cd49a1d8fd15275b55dd0b.tar.gz
chromium_src-3cb7c2b55cfa24ae40cd49a1d8fd15275b55dd0b.tar.bz2
Replace the use of CLD_DATA_FROM* and CLD-related ifdefs with runtime checks.
This, along with other changes described in crbug/367239, allows refactoring of the build logic to allow per-target customization of the CLD data source. This, in turn, allows chrome_shell to be built with statically-linked CLD even if other things (such as the full browser) are not. BUG=367239 TBR=toyoshim@chromium.org Review URL: https://codereview.chromium.org/424123003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/translate')
-rw-r--r--components/translate/content/common/cld_data_source.h17
-rw-r--r--components/translate/content/common/component_cld_data_source.cc14
-rw-r--r--components/translate/content/common/standalone_cld_data_source.cc14
-rw-r--r--components/translate/content/common/static_cld_data_source.cc14
4 files changed, 49 insertions, 10 deletions
diff --git a/components/translate/content/common/cld_data_source.h b/components/translate/content/common/cld_data_source.h
index 1ba6511..07a56b0 100644
--- a/components/translate/content/common/cld_data_source.h
+++ b/components/translate/content/common/cld_data_source.h
@@ -24,9 +24,24 @@ class CldDataSource {
// implementations.
//
// Other implementations based upon Chromium may provide CLD differently and
- // may have other names.
+ // may have other names. This method is primarily provided for those
+ // non-Chromium implementations; Chromium implementations should use the
+ // boolean methods in this class instead:
+ // ShouldRegisterForComponentUpdates()
+ // ShouldUseStandaloneDataFile()
static std::string GetName();
+ // Returns true if the data source needs to receive updates from the
+ // Component Updater.
+ // This is only true if the data source name is "component", but makes caller
+ // logic more generic.
+ static bool ShouldRegisterForComponentUpdates();
+
+ // Returns true if the data source needs to have the path to the CLD
+ // data file configured immediately because it is bundled with Chromium.
+ // This is only true if the data source name is "standalone", but makes
+ // caller logic more generic.
+ static bool ShouldUseStandaloneDataFile();
};
} // namespace translate
diff --git a/components/translate/content/common/component_cld_data_source.cc b/components/translate/content/common/component_cld_data_source.cc
index cc493fc..feec37e 100644
--- a/components/translate/content/common/component_cld_data_source.cc
+++ b/components/translate/content/common/component_cld_data_source.cc
@@ -6,8 +6,16 @@
namespace translate {
- std::string CldDataSource::GetName() {
- return "component";
- }
+std::string CldDataSource::GetName() {
+ return "component";
+}
+
+bool CldDataSource::ShouldRegisterForComponentUpdates() {
+ return true;
+}
+
+bool CldDataSource::ShouldUseStandaloneDataFile() {
+ return false;
+}
} // namespace translate
diff --git a/components/translate/content/common/standalone_cld_data_source.cc b/components/translate/content/common/standalone_cld_data_source.cc
index 1e715c3..286ef1d 100644
--- a/components/translate/content/common/standalone_cld_data_source.cc
+++ b/components/translate/content/common/standalone_cld_data_source.cc
@@ -6,8 +6,16 @@
namespace translate {
- std::string CldDataSource::GetName() {
- return "standalone";
- }
+std::string CldDataSource::GetName() {
+ return "standalone";
+}
+
+bool CldDataSource::ShouldRegisterForComponentUpdates() {
+ return false;
+}
+
+bool CldDataSource::ShouldUseStandaloneDataFile() {
+ return true;
+}
} // namespace translate
diff --git a/components/translate/content/common/static_cld_data_source.cc b/components/translate/content/common/static_cld_data_source.cc
index b744abb..5673b43 100644
--- a/components/translate/content/common/static_cld_data_source.cc
+++ b/components/translate/content/common/static_cld_data_source.cc
@@ -6,8 +6,16 @@
namespace translate {
- std::string CldDataSource::GetName() {
- return "static";
- }
+std::string CldDataSource::GetName() {
+ return "static";
+}
+
+bool CldDataSource::ShouldRegisterForComponentUpdates() {
+ return false;
+}
+
+bool CldDataSource::ShouldUseStandaloneDataFile() {
+ return false;
+}
} // namespace translate