summaryrefslogtreecommitdiffstats
path: root/components/translate
diff options
context:
space:
mode:
authorandrewhayden@chromium.org <andrewhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-29 12:16:28 +0000
committerandrewhayden@chromium.org <andrewhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-29 12:16:28 +0000
commit412210cd7f36100764c53325ccedd187d6e57bdc (patch)
treea7b291a2a67734e91e76d590da595c5b546f0a92 /components/translate
parent8e04fe4bf4b0525d9397ae91918b6916878f6d96 (diff)
downloadchromium_src-412210cd7f36100764c53325ccedd187d6e57bdc.zip
chromium_src-412210cd7f36100764c53325ccedd187d6e57bdc.tar.gz
chromium_src-412210cd7f36100764c53325ccedd187d6e57bdc.tar.bz2
Add a new CldDataSource class that can be queried at runtime.
This will allow several "#if defined" statements to be replaced with runtime checks, simplifying the build process and eliminating the need to generate multiple libraries for several targets when building Android's chrome_shell in the presence of non-static CLD data sources. BUG=367239 TBR=toyoshim Review URL: https://codereview.chromium.org/422843009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286177 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/translate')
-rw-r--r--components/translate/content/common/BUILD.gn10
-rw-r--r--components/translate/content/common/cld_data_source.h33
-rw-r--r--components/translate/content/common/component_cld_data_source.cc13
-rw-r--r--components/translate/content/common/standalone_cld_data_source.cc13
-rw-r--r--components/translate/content/common/static_cld_data_source.cc13
5 files changed, 82 insertions, 0 deletions
diff --git a/components/translate/content/common/BUILD.gn b/components/translate/content/common/BUILD.gn
index 0125046..44affb3 100644
--- a/components/translate/content/common/BUILD.gn
+++ b/components/translate/content/common/BUILD.gn
@@ -8,6 +8,7 @@ static_library("common") {
sources = [
"translate_messages.cc",
"translate_messages.h",
+ "cld_data_source.h",
]
deps = [
@@ -24,4 +25,13 @@ static_library("common") {
"data_file_cld_data_provider_messages.h",
]
}
+ if (cld2_data_source == "standalone") {
+ sources += [ "standalone_cld_data_source.cc" ]
+ }
+ if (cld2_data_source == "component") {
+ sources += [ "component_cld_data_source.cc" ]
+ }
+ if (cld2_data_source == "static") {
+ sources += [ "static_cld_data_source.cc" ]
+ }
}
diff --git a/components/translate/content/common/cld_data_source.h b/components/translate/content/common/cld_data_source.h
new file mode 100644
index 0000000..1ba6511
--- /dev/null
+++ b/components/translate/content/common/cld_data_source.h
@@ -0,0 +1,33 @@
+// 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 COMPONENTS_TRANSLATE_CONTENT_COMMON_CLD_DATA_SOURCE_H_
+#define COMPONENTS_TRANSLATE_CONTENT_COMMON_CLD_DATA_SOURCE_H_
+
+#include <string>
+
+namespace translate {
+
+// Provides high-level functionality related to a CLD Data Source.
+class CldDataSource {
+
+ public:
+
+ // Returns the symbolic name of the data source. In the Chromium
+ // open-source tree, the following data sources exist:
+ // static uses the static_[browser|renderer]_cld_data_provider
+ // implementations.
+ // standalone uses the data_file_[browser|renderer]_cld_data_provider
+ // implementations.
+ // component also uses the data_file_[browser|renderer]_cld_data_provider
+ // implementations.
+ //
+ // Other implementations based upon Chromium may provide CLD differently and
+ // may have other names.
+ static std::string GetName();
+
+};
+
+} // namespace translate
+#endif // COMPONENTS_TRANSLATE_CONTENT_COMMON_CLD_DATA_SOURCE_H_
diff --git a/components/translate/content/common/component_cld_data_source.cc b/components/translate/content/common/component_cld_data_source.cc
new file mode 100644
index 0000000..cc493fc
--- /dev/null
+++ b/components/translate/content/common/component_cld_data_source.cc
@@ -0,0 +1,13 @@
+// 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.
+
+#include "cld_data_source.h"
+
+namespace translate {
+
+ std::string CldDataSource::GetName() {
+ return "component";
+ }
+
+} // namespace translate
diff --git a/components/translate/content/common/standalone_cld_data_source.cc b/components/translate/content/common/standalone_cld_data_source.cc
new file mode 100644
index 0000000..1e715c3
--- /dev/null
+++ b/components/translate/content/common/standalone_cld_data_source.cc
@@ -0,0 +1,13 @@
+// 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.
+
+#include "cld_data_source.h"
+
+namespace translate {
+
+ std::string CldDataSource::GetName() {
+ return "standalone";
+ }
+
+} // namespace translate
diff --git a/components/translate/content/common/static_cld_data_source.cc b/components/translate/content/common/static_cld_data_source.cc
new file mode 100644
index 0000000..b744abb
--- /dev/null
+++ b/components/translate/content/common/static_cld_data_source.cc
@@ -0,0 +1,13 @@
+// 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.
+
+#include "cld_data_source.h"
+
+namespace translate {
+
+ std::string CldDataSource::GetName() {
+ return "static";
+ }
+
+} // namespace translate