summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--remoting/base/resources.cc12
-rw-r--r--remoting/base/resources_unittest.cc25
-rw-r--r--remoting/grit_action.gypi32
-rw-r--r--remoting/remoting.gyp38
-rw-r--r--remoting/resources/common_resources.grd18
-rw-r--r--remoting/resources/resource_ids3
6 files changed, 105 insertions, 23 deletions
diff --git a/remoting/base/resources.cc b/remoting/base/resources.cc
index cd7e486..32e62c4 100644
--- a/remoting/base/resources.cc
+++ b/remoting/base/resources.cc
@@ -11,16 +11,24 @@
namespace remoting {
+namespace {
+const char kLocaleResourcesDirName[] = "remoting_locales";
+const char kCommonResourcesFileName[] = "chrome_remote_desktop.pak";
+} // namespace
+
// Loads chromoting resources.
bool LoadResources(const std::string& locale) {
FilePath path;
if (!PathService::Get(base::DIR_MODULE, &path))
return false;
- path = path.Append(FILE_PATH_LITERAL("remoting_locales"));
- PathService::Override(ui::DIR_LOCALES, path);
+ PathService::Override(ui::DIR_LOCALES,
+ path.AppendASCII(kLocaleResourcesDirName));
ui::ResourceBundle::InitSharedInstanceLocaleOnly(locale, NULL);
+ ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
+ path.AppendASCII(kCommonResourcesFileName), ui::SCALE_FACTOR_100P);
+
return true;
}
diff --git a/remoting/base/resources_unittest.cc b/remoting/base/resources_unittest.cc
index 45f94ee..aa94ec3 100644
--- a/remoting/base/resources_unittest.cc
+++ b/remoting/base/resources_unittest.cc
@@ -4,6 +4,7 @@
#include "remoting/base/resources.h"
+#include "remoting/base/common_resources.h"
#include "remoting/base/string_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -15,19 +16,37 @@ namespace remoting {
// the test.
#if !defined(OS_MACOSX)
#define MAYBE_ProductName ProductName
+#define MAYBE_ProductLogo ProductLogo
#else // !defined(OS_MACOSX)
#define MAYBE_ProductName DISABLED_ProductName
+#define MAYBE_ProductLogo DISABLED_ProductLogo
#endif // defined(OS_MACOSX)
-TEST(Resources, MAYBE_ProductName) {
+
+class ResourcesTest : public testing::Test {
+ protected:
+ void SetUp() OVERRIDE {
+ ASSERT_TRUE(LoadResources("en-US"));
+ }
+
+ void TearDown() OVERRIDE {
+ ui::ResourceBundle::CleanupSharedInstance();
+ }
+};
+
+TEST_F(ResourcesTest, MAYBE_ProductName) {
#if defined(GOOGLE_CHROME_BUILD)
std::string expected_product_name = "Chrome Remote Desktop";
#else // defined(GOOGLE_CHROME_BUILD)
std::string expected_product_name = "Chromoting";
#endif // !defined(GOOGLE_CHROME_BUILD)
- ASSERT_TRUE(LoadResources("en-US"));
EXPECT_EQ(expected_product_name,
l10n_util::GetStringUTF8(IDR_REMOTING_PRODUCT_NAME));
- ui::ResourceBundle::CleanupSharedInstance();
+}
+
+TEST_F(ResourcesTest, MAYBE_ProductLogo) {
+ gfx::Image logo = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
+ IDR_PRODUCT_LOGO_16);
+ EXPECT_FALSE(logo.IsEmpty());
}
} // namespace remoting
diff --git a/remoting/grit_action.gypi b/remoting/grit_action.gypi
new file mode 100644
index 0000000..a9a658f
--- /dev/null
+++ b/remoting/grit_action.gypi
@@ -0,0 +1,32 @@
+# Copyright (c) 2012 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.
+
+# This file is mostly a copy of base/grit_action.gypi . There are two
+# differences:
+# 1. Remoting resources are build with a different resource_ids file.
+# 2. File specified by variable base_grit_grd_file is used to generate list of
+# inputs and outputs.
+
+{
+ 'variables': {
+ 'grit_cmd': ['python', '<(DEPTH)/tools/grit/grit.py'],
+ },
+ 'inputs': [
+ '<(resource_ids_file)',
+ '<(grit_grd_file)',
+ '<!@pymod_do_main(grit_info <@(grit_defines) '
+ '--inputs <(base_grit_grd_file) -fresource_ids)',
+ ],
+ 'outputs': [
+ '<!@pymod_do_main(grit_info <@(grit_defines) '
+ '--outputs \'<(grit_out_dir)\' <(base_grit_grd_file) -fresource_ids)',
+ ],
+ 'action': ['<@(grit_cmd)',
+ '-i', '<(grit_grd_file)', 'build',
+ '-fresource_ids',
+ '-o', '<(grit_out_dir)',
+ '<@(grit_defines)' ],
+ 'msvs_cygwin_shell': 0,
+ 'message': 'Generating resources from <(grit_grd_file)',
+}
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index 1ada420..6e3365e 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -1294,34 +1294,36 @@
],
'actions': [
{
- 'action_name': 'generate_resources',
+ 'action_name': 'string_resources',
'variables': {
- 'grit_cmd': ['python', '<(DEPTH)/tools/grit/grit.py'],
+ 'grit_grd_file': '<(strings_grd_file)',
+ 'base_grit_grd_file': '<(base_strings_grd_file)',
},
- 'inputs': [
- '<(strings_grd_file)',
- '<(resource_ids_file)',
- ],
- 'outputs': [
- '<!@pymod_do_main(grit_info <@(grit_defines) '
- '--outputs \'<(grit_out_dir)\' <(base_strings_grd_file))',
- ],
- 'action': ['<@(grit_cmd)',
- '-i', '<(strings_grd_file)', 'build',
- '-fresource_ids',
- '-o', '<(grit_out_dir)',
- '<@(grit_defines)' ],
- 'msvs_cygwin_shell': 0,
- 'message': 'Generating resources from <(strings_grd_file)',
+ 'includes': [ 'grit_action.gypi' ],
+ },
+ {
+ 'action_name': 'common_resources',
+ 'variables': {
+ 'grit_grd_file': 'resources/common_resources.grd',
+ 'base_grit_grd_file': 'resources/common_resources.grd',
+ },
+ 'includes': [ 'grit_action.gypi' ],
},
],
'copies': [
- { # Copy results to the product directory.
+ # Copy results to the product directory.
+ {
'destination': '<(PRODUCT_DIR)/remoting_locales',
'files': [
'<(grit_out_dir)/remoting/resources/en-US.pak',
]
},
+ {
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': [
+ '<(grit_out_dir)/remoting/resources/chrome_remote_desktop.pak',
+ ]
+ },
],
'includes': [ '../build/grit_target.gypi' ],
}, # end of target 'remoting_resources'
diff --git a/remoting/resources/common_resources.grd b/remoting/resources/common_resources.grd
new file mode 100644
index 0000000..e0d4520
--- /dev/null
+++ b/remoting/resources/common_resources.grd
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<grit base_dir="." latest_public_release="0" current_release="1"
+ source_lang_id="en" enc_check="möl">
+ <outputs>
+ <output filename="remoting/base/common_resources.h" type="rc_header" context="default_100_percent">
+ <emit emit_type='prepend'></emit>
+ </output>
+ <output filename="remoting/resources/chrome_remote_desktop.pak" type="data_package"
+ lang="en" context="default_100_percent" />
+ </outputs>
+ <release seq="1" allow_pseudo="false">
+ <structures fallback_to_low_resolution="true">
+ <structure type="chrome_scaled_image" name="IDR_PRODUCT_LOGO_16" file="chromoting16.png" />
+ <structure type="chrome_scaled_image" name="IDR_PRODUCT_LOGO_32" file="chromoting32.png" />
+ </structures>
+ </release>
+</grit>
diff --git a/remoting/resources/resource_ids b/remoting/resources/resource_ids
index 11d7121..4b42679 100644
--- a/remoting/resources/resource_ids
+++ b/remoting/resources/resource_ids
@@ -19,4 +19,7 @@
"remoting/resources/string_resources.grd": {
"messages": [1000],
},
+ "remoting/resources/common_resources.grd": {
+ "structures": [10000],
+ },
}