summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util
diff options
context:
space:
mode:
authorrahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-19 18:04:51 +0000
committerrahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-19 18:04:51 +0000
commit4880adb3346faa91feea9d8ecfecc4ef499bf7fc (patch)
tree8b8e1247c6b3d825727cf567fc1883a1a8036064 /chrome/installer/util
parent5e30856836aa02569377f43f6f62af7badb1cee7 (diff)
downloadchromium_src-4880adb3346faa91feea9d8ecfecc4ef499bf7fc.zip
chromium_src-4880adb3346faa91feea9d8ecfecc4ef499bf7fc.tar.gz
chromium_src-4880adb3346faa91feea9d8ecfecc4ef499bf7fc.tar.bz2
Refactor localized strings used in installer for Chromium/Google Chrome separation (see other change out for review - chromium_1).
- Rename resources files as util_strings.* as they will be used by classes in util project. - Instead of directly accessing resource, chrome.dll and setup.exe will get the resource from helper class in util project. Remove references to header file from projects. - The resources still need be bundled in the binary so directly include util_strings.rc in resource file. - Add another string "Google Inc" in resource file to use as Publisher name. - Remove uninstall URL from resource file. This URL is not going to be localized, we are manually appending language parameter to it. BUG=1296800 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1044 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util')
-rw-r--r--chrome/installer/util/browser_distribution.cc4
-rw-r--r--chrome/installer/util/browser_distribution.h2
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc35
-rw-r--r--chrome/installer/util/google_chrome_distribution.h2
-rw-r--r--chrome/installer/util/l10n_string_util.cc2
-rw-r--r--chrome/installer/util/prebuild/create_string_rc.py15
-rw-r--r--chrome/installer/util/prebuild/using_util_prebuild.vsprops (renamed from chrome/installer/util/prebuild/util_prebuild.vsprops)0
-rw-r--r--chrome/installer/util/prebuild/util_prebuild.vcproj4
-rw-r--r--chrome/installer/util/shell_util.cc5
-rw-r--r--chrome/installer/util/using_util.vsprops15
-rw-r--r--chrome/installer/util/util.vcproj4
11 files changed, 60 insertions, 28 deletions
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc
index 3c02cb0..2566591 100644
--- a/chrome/installer/util/browser_distribution.cc
+++ b/chrome/installer/util/browser_distribution.cc
@@ -71,6 +71,10 @@ int BrowserDistribution::GetInstallReturnCode(
return install_status;
}
+std::wstring BrowserDistribution::GetUninstallLinkName() {
+ return L"Uninstall Chromium";
+}
+
std::wstring BrowserDistribution::GetUninstallRegPath() {
return L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Chromium";
}
diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h
index 3ede388..d1a2c62 100644
--- a/chrome/installer/util/browser_distribution.h
+++ b/chrome/installer/util/browser_distribution.h
@@ -55,6 +55,8 @@ class BrowserDistribution {
virtual int GetInstallReturnCode(
installer_util::InstallStatus install_status);
+ virtual std::wstring GetUninstallLinkName();
+
virtual std::wstring GetUninstallRegPath();
virtual std::wstring GetVersionKey();
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index 2623b36..8a7a1e6 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -42,28 +42,25 @@
#include "base/string_util.h"
#include "base/wmi_util.h"
#include "chrome/installer/util/install_util.h"
+#include "chrome/installer/util/l10n_string_util.h"
#include "chrome/installer/util/google_update_constants.h"
+#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/logging_installer.h"
+#include "installer_util_strings.h"
+
namespace {
+// Substitute the locale parameter in uninstall URL with whatever
+// Google Update tells us is the locale. In case we fail to find
+// the locale, we use US English.
std::wstring GetUninstallSurveyUrl() {
- /* TODO(rahulk): Make this work (requires some serious refactoring of
- resources and GoogleUpdateSettings class) and get rid of #ifdef from
- uninstall.cc.
- const ATLSTRINGRESOURCEIMAGE* image = AtlGetStringResourceImage(
- _AtlBaseModule.GetModuleInstance(), IDS_UNINSTALL_SURVEY_URL);
- DCHECK(image);
- std::wstring url = std::wstring(image->achString, image->nLength);
- DCHECK(!url.empty());
+ std::wstring kSurveyUrl = L"http://www.google.com/support/chrome/bin/request.py?hl=$1&contact_type=uninstall";
std::wstring language;
if (!GoogleUpdateSettings::GetLanguage(&language))
language = L"en-US"; // Default to US English.
- return ReplaceStringPlaceholders(url.c_str(), language.c_str(), NULL);
- */
- return L"";
-
+ return ReplaceStringPlaceholders(kSurveyUrl.c_str(), language.c_str(), NULL);
}
}
@@ -121,7 +118,9 @@ void GoogleChromeDistribution::DoPreUninstallOperations() {
}
std::wstring GoogleChromeDistribution::GetApplicationName() {
- return L"Google Chrome";
+ const std::wstring& product_name =
+ installer_util::GetLocalizedString(IDS_PRODUCT_NAME_BASE);
+ return product_name;
}
std::wstring GoogleChromeDistribution::GetInstallSubDir() {
@@ -154,7 +153,9 @@ std::wstring GoogleChromeDistribution::GetNewGoogleUpdateApKey(bool diff_install
}
std::wstring GoogleChromeDistribution::GetPublisherName() {
- return L"Google";
+ const std::wstring& publisher_name =
+ installer_util::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE);
+ return publisher_name;
}
int GoogleChromeDistribution::GetInstallReturnCode(
@@ -170,6 +171,12 @@ int GoogleChromeDistribution::GetInstallReturnCode(
}
}
+std::wstring GoogleChromeDistribution::GetUninstallLinkName() {
+ const std::wstring& link_name =
+ installer_util::GetLocalizedString(IDS_UNINSTALL_CHROME_BASE);
+ return link_name;
+}
+
std::wstring GoogleChromeDistribution::GetUninstallRegPath() {
return L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Google Chrome";
}
diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h
index f1d6af9..2b2336d 100644
--- a/chrome/installer/util/google_chrome_distribution.h
+++ b/chrome/installer/util/google_chrome_distribution.h
@@ -66,6 +66,8 @@ class GoogleChromeDistribution : public BrowserDistribution {
virtual int GetInstallReturnCode(
installer_util::InstallStatus install_status);
+ virtual std::wstring GetUninstallLinkName();
+
virtual std::wstring GetUninstallRegPath();
virtual std::wstring GetVersionKey();
diff --git a/chrome/installer/util/l10n_string_util.cc b/chrome/installer/util/l10n_string_util.cc
index 97c9d76..dba8459 100644
--- a/chrome/installer/util/l10n_string_util.cc
+++ b/chrome/installer/util/l10n_string_util.cc
@@ -5,7 +5,7 @@
#include "base/logging.h"
#include "base/string_util.h"
-#include "setup_strings.h"
+#include "installer_util_strings.h"
namespace {
diff --git a/chrome/installer/util/prebuild/create_string_rc.py b/chrome/installer/util/prebuild/create_string_rc.py
index ca4fd09..3eb56e4 100644
--- a/chrome/installer/util/prebuild/create_string_rc.py
+++ b/chrome/installer/util/prebuild/create_string_rc.py
@@ -38,6 +38,7 @@ import FP
kStringIds = [
'IDS_PRODUCT_NAME',
'IDS_UNINSTALL_CHROME',
+ 'IDS_ABOUT_VERSION_COMPANY_NAME',
]
# The ID of the first resource string.
@@ -116,10 +117,10 @@ def WriteRCFile(translated_strings, out_filename):
"""Writes a resource (rc) file with all the language strings provided in
|translated_strings|."""
kHeaderText = (
- u'#include "setup_strings.h"\n\n'
+ u'#include "%s.h"\n\n'
u'STRINGTABLE\n'
u'BEGIN\n'
- )
+ ) % os.path.basename(out_filename)
kFooterText = (
u'END\n'
)
@@ -128,7 +129,7 @@ def WriteRCFile(translated_strings, out_filename):
lines.append(u' %s "%s"\n' % (translation_struct.resource_id_str,
translation_struct.translation))
lines.append(kFooterText)
- outfile = open(out_filename, 'wb')
+ outfile = open(out_filename + '.rc', 'wb')
outfile.write(''.join(lines).encode('utf-16'))
outfile.close()
@@ -162,16 +163,16 @@ def WriteHeaderFile(translated_strings, out_filename):
string_id,
translated_strings[0].language))
- outfile = open(out_filename, 'wb')
+ outfile = open(out_filename + '.h', 'wb')
outfile.write('\n'.join(lines))
outfile.write('\n') # .rc files must end in a new line
outfile.close()
def main(argv):
translated_strings = CollectTranslatedStrings()
- kFilebase = os.path.join(argv[1], 'setup_strings')
- WriteRCFile(translated_strings, kFilebase + '.rc')
- WriteHeaderFile(translated_strings, kFilebase + '.h')
+ kFilebase = os.path.join(argv[1], 'installer_util_strings')
+ WriteRCFile(translated_strings, kFilebase)
+ WriteHeaderFile(translated_strings, kFilebase)
if '__main__' == __name__:
if len(sys.argv) < 2:
diff --git a/chrome/installer/util/prebuild/util_prebuild.vsprops b/chrome/installer/util/prebuild/using_util_prebuild.vsprops
index 2fa7bc5..2fa7bc5 100644
--- a/chrome/installer/util/prebuild/util_prebuild.vsprops
+++ b/chrome/installer/util/prebuild/using_util_prebuild.vsprops
diff --git a/chrome/installer/util/prebuild/util_prebuild.vcproj b/chrome/installer/util/prebuild/util_prebuild.vcproj
index d3efe6d..6432f2c 100644
--- a/chrome/installer/util/prebuild/util_prebuild.vcproj
+++ b/chrome/installer/util/prebuild/util_prebuild.vcproj
@@ -26,7 +26,7 @@
Name="VCCustomBuildTool"
CommandLine="create_string_rc.bat $(IntDir)"
AdditionalDependencies="create_string_rc.py;$(SolutionDir)\app\generated_resources.grd"
- Outputs="$(IntDir)\setup_strings.rc;$(IntDir)\setup_strings.h"
+ Outputs="$(IntDir)\installer_util_strings.rc;$(IntDir)\installer_util_strings.h"
/>
<Tool
Name="VCMIDLTool"
@@ -47,7 +47,7 @@
Name="VCCustomBuildTool"
CommandLine="create_string_rc.bat $(IntDir)"
AdditionalDependencies="create_string_rc.py;$(SolutionDir)\app\generated_resources.grd"
- Outputs="$(IntDir)\setup_strings.rc;$(IntDir)\setup_strings.h"
+ Outputs="$(IntDir)\installer_util_strings.rc;$(IntDir)\installer_util_strings.h"
/>
<Tool
Name="VCMIDLTool"
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index bc8b882..144a811 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -54,7 +54,7 @@
#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/work_item.h"
-#include "setup_strings.h"
+#include "installer_util_strings.h"
namespace {
@@ -333,7 +333,8 @@ bool ShellUtil::GetChromeIcon(std::wstring& chrome_icon) {
}
bool ShellUtil::GetChromeShortcutName(std::wstring* shortcut) {
- shortcut->assign(installer_util::GetLocalizedString(IDS_PRODUCT_NAME_BASE));
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ shortcut->assign(dist->GetApplicationName());
shortcut->append(L".lnk");
return true;
}
diff --git a/chrome/installer/util/using_util.vsprops b/chrome/installer/util/using_util.vsprops
new file mode 100644
index 0000000..ba65543
--- /dev/null
+++ b/chrome/installer/util/using_util.vsprops
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="using_util"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(IntDir)\..\util_prebuild\"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(IntDir)\..\util_prebuild\"
+ />
+</VisualStudioPropertySheet>
diff --git a/chrome/installer/util/util.vcproj b/chrome/installer/util/util.vcproj
index 8fcb759..c57ff78 100644
--- a/chrome/installer/util/util.vcproj
+++ b/chrome/installer/util/util.vcproj
@@ -17,7 +17,7 @@
<Configuration
Name="Debug|Win32"
ConfigurationType="4"
- InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\build\debug.vsprops;$(SolutionDir)common\common.vsprops;$(SolutionDir)..\third_party\lzma_sdk\using_lzma_sdk.vsprops;prebuild\util_prebuild.vsprops"
+ InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\build\debug.vsprops;$(SolutionDir)common\common.vsprops;$(SolutionDir)installer\util\using_util.vsprops;$(SolutionDir)..\third_party\lzma_sdk\using_lzma_sdk.vsprops"
>
<Tool
Name="VCCLCompilerTool"
@@ -29,7 +29,7 @@
<Configuration
Name="Release|Win32"
ConfigurationType="4"
- InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\build\release.vsprops;$(SolutionDir)common\common.vsprops;$(SolutionDir)..\third_party\lzma_sdk\using_lzma_sdk.vsprops;prebuild\util_prebuild.vsprops"
+ InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\build\release.vsprops;$(SolutionDir)common\common.vsprops;$(SolutionDir)installer\util\using_util.vsprops;$(SolutionDir)..\third_party\lzma_sdk\using_lzma_sdk.vsprops"
>
<Tool
Name="VCCLCompilerTool"