summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-25 02:24:18 +0000
committersail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-25 02:24:18 +0000
commit8973c3a2aa49807495c55cb8ff6e2e7b31621eaf (patch)
tree3cd138dc8854e3e45b6cbc8933787d1598a3d4de
parent42d194d32e7c310414769a11e7eae3381ff90abf (diff)
downloadchromium_src-8973c3a2aa49807495c55cb8ff6e2e7b31621eaf.zip
chromium_src-8973c3a2aa49807495c55cb8ff6e2e7b31621eaf.tar.gz
chromium_src-8973c3a2aa49807495c55cb8ff6e2e7b31621eaf.tar.bz2
Metro/HiDPI: Use metro resource pak in metro mode
This CL does the following: - add a new enable_metro build flag - if the build flag is set then add a new metro icon resource pak to chrome - at run time if Chrome is running in metro mode AND ENABLE_METRO is set then use the metro icon resource pak BUG=114311 TEST= Review URL: http://codereview.chromium.org/10082020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133843 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--build/common.gypi9
-rw-r--r--chrome/app/theme/theme_resources_metro_1x.grd4
-rw-r--r--chrome/chrome_resources.gyp17
-rw-r--r--chrome/installer/mini_installer/chrome.release3
-rw-r--r--chrome/tools/build/win/FILES.cfg5
-rwxr-xr-xchrome/tools/build/win/create_installer_archive.py13
-rw-r--r--chrome/tools/build/win/release.rules2
-rw-r--r--tools/gritsettings/resource_ids3
-rw-r--r--ui/base/resource/resource_bundle_win.cc20
-rw-r--r--ui/base/win/metro.cc20
-rw-r--r--ui/base/win/metro.h18
-rw-r--r--ui/ui.gyp2
12 files changed, 105 insertions, 11 deletions
diff --git a/build/common.gypi b/build/common.gypi
index db5bf66..5889045 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -43,6 +43,9 @@
# Enable HiDPI support.
'enable_hidpi%': 0,
+
+ # Enable Metro support.
+ 'enable_metro%': 0,
},
# Copy conditionally-set variables out one scope.
'chromeos%': '<(chromeos)',
@@ -53,6 +56,7 @@
'use_virtual_keyboard%': '<(use_virtual_keyboard)',
'enable_viewport%': '<(enable_viewport)',
'enable_hidpi%': '<(enable_hidpi)',
+ 'enable_metro%': '<(enable_metro)',
# Compute the architecture that we're building on.
'conditions': [
@@ -105,6 +109,7 @@
'use_virtual_keyboard%': '<(use_virtual_keyboard)',
'enable_viewport%': '<(enable_viewport)',
'enable_hidpi%': '<(enable_hidpi)',
+ 'enable_metro%': '<(enable_metro)',
# We used to provide a variable for changing how libraries were built.
# This variable remains until we can clean up all the users.
@@ -503,6 +508,7 @@
'use_virtual_keyboard%': '<(use_virtual_keyboard)',
'enable_viewport%': '<(enable_viewport)',
'enable_hidpi%': '<(enable_hidpi)',
+ 'enable_metro%': '<(enable_metro)',
'use_xi2_mt%':'<(use_xi2_mt)',
'file_manager_extension%': '<(file_manager_extension)',
'webui_task_manager%': '<(webui_task_manager)',
@@ -1301,6 +1307,9 @@
['enable_hidpi==1', {
'defines': ['ENABLE_HIDPI=1'],
}],
+ ['enable_metro==1', {
+ 'defines': ['ENABLE_METRO=1'],
+ }],
['fastbuild!=0', {
'conditions': [
diff --git a/chrome/app/theme/theme_resources_metro_1x.grd b/chrome/app/theme/theme_resources_metro_1x.grd
index 610b9ae..a7eed02 100644
--- a/chrome/app/theme/theme_resources_metro_1x.grd
+++ b/chrome/app/theme/theme_resources_metro_1x.grd
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1">
<outputs>
- <output filename="grit/theme_resources_2x.h" type="rc_header">
+ <output filename="grit/theme_resources_metro_1x.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
- <output filename="theme_resources_2x.pak" type="data_package" />
+ <output filename="theme_resources_metro_1x.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
diff --git a/chrome/chrome_resources.gyp b/chrome/chrome_resources.gyp
index 18f88fb..31de62b 100644
--- a/chrome/chrome_resources.gyp
+++ b/chrome/chrome_resources.gyp
@@ -217,6 +217,13 @@
},
'includes': [ '../build/grit_action.gypi' ],
},
+ {
+ 'action_name': 'theme_resources_metro_1x',
+ 'variables': {
+ 'grit_grd_file': 'app/theme/theme_resources_metro_1x.grd',
+ },
+ 'includes': [ '../build/grit_action.gypi' ],
+ },
],
'includes': [ '../build/grit_target.gypi' ],
},
@@ -260,6 +267,16 @@
},
],
}],
+ ['enable_metro == 1', {
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': [
+ '<(grit_out_dir)/theme_resources_metro_1x.pak',
+ ],
+ },
+ ],
+ }],
],
},
{
diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release
index b99fab4..1b63134 100644
--- a/chrome/installer/mini_installer/chrome.release
+++ b/chrome/installer/mini_installer/chrome.release
@@ -36,6 +36,9 @@ default_apps\external_extensions.json: %(VersionDir)s\default_apps\
theme_resources_2x.pak: %(VersionDir)s\
ui_resources_2x.pak: %(VersionDir)s\
+[METRO]
+theme_resources_metro_1x.pak: %(VersionDir)s\
+
[GOOGLE_CHROME]
splash-620x300.png: %(ChromeDir)s\
Logo.png: %(ChromeDir)s\
diff --git a/chrome/tools/build/win/FILES.cfg b/chrome/tools/build/win/FILES.cfg
index 7fc10bd..5a9aac6 100644
--- a/chrome/tools/build/win/FILES.cfg
+++ b/chrome/tools/build/win/FILES.cfg
@@ -352,6 +352,11 @@ FILES = [
'buildtype': ['dev', 'official'],
},
{
+ 'filename': 'theme_resources_metro_1x.pak',
+ 'arch': ['32bit', '64bit'],
+ 'buildtype': ['dev', 'official'],
+ },
+ {
'filename': 'ui_resources_standard.pak',
'arch': ['32bit', '64bit'],
'buildtype': ['dev', 'official'],
diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py
index 2e85d9b..cab244c 100755
--- a/chrome/tools/build/win/create_installer_archive.py
+++ b/chrome/tools/build/win/create_installer_archive.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# 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.
@@ -90,7 +90,7 @@ def CompressUsingLZMA(build_dir, compressed_file, input_file):
def CopyAllFilesToStagingDir(config, distribution, staging_dir, build_dir,
- enable_hidpi):
+ enable_hidpi, enable_metro):
"""Copies the files required for installer archive.
Copies all common files required for various distributions of Chromium and
also files for the specific Chromium build specified by distribution.
@@ -103,6 +103,8 @@ def CopyAllFilesToStagingDir(config, distribution, staging_dir, build_dir,
staging_dir, build_dir)
if enable_hidpi == '1':
CopySectionFilesToStagingDir(config, 'HIDPI', staging_dir, build_dir)
+ if enable_metro == '1':
+ CopySectionFilesToStagingDir(config, 'METRO', staging_dir, build_dir)
def CopySectionFilesToStagingDir(config, section, staging_dir, build_dir):
@@ -328,12 +330,12 @@ def main(options):
if options.build_dir != options.output_dir:
CopyAllFilesToStagingDir(config, options.distribution,
staging_dir, options.output_dir,
- options.enable_hidpi)
+ options.enable_hidpi, options.enable_metro)
# Now copy the remainder of the files from the build dir.
CopyAllFilesToStagingDir(config, options.distribution,
staging_dir, options.build_dir,
- options.enable_hidpi)
+ options.enable_hidpi, options.enable_metro)
version_numbers = current_version.split('.')
current_build_number = version_numbers[2] + '.' + version_numbers[3]
@@ -387,6 +389,9 @@ def _ParseOptions():
help='Name used to prefix names of generated archives.')
parser.add_option('--enable_hidpi', default='0',
help='Whether to include HiDPI resource files.')
+ parser.add_option('--enable_metro', default='0',
+ help='Whether to include resource files from the "METRO" section of the '
+ 'input file.')
options, args = parser.parse_args()
if not options.build_dir:
diff --git a/chrome/tools/build/win/release.rules b/chrome/tools/build/win/release.rules
index cd3212b..0f98ef2 100644
--- a/chrome/tools/build/win/release.rules
+++ b/chrome/tools/build/win/release.rules
@@ -7,7 +7,7 @@
<CustomBuildRule
Name="Create Installer Archive"
DisplayName="Create Installer Archive"
- CommandLine="$(SolutionDir)..\third_party\python_24\python.exe $(SolutionDir)tools\build\win\create_installer_archive.py --output_dir=&quot;$(OutDir)&quot; --input_file=&quot;$(InputPath)&quot; --distribution=$(CHROMIUM_BUILD) --enable_hidpi=$(ENABLE_HIDPI) [LastChromeInstaller] [SkipRebuildArchive] [SetupExeFormat] [DiffAlgorithm]"
+ CommandLine="$(SolutionDir)..\third_party\python_24\python.exe $(SolutionDir)tools\build\win\create_installer_archive.py --output_dir=&quot;$(OutDir)&quot; --input_file=&quot;$(InputPath)&quot; --distribution=$(CHROMIUM_BUILD) --enable_hidpi=$(ENABLE_HIDPI) --enable_metro=$(ENABLE_METRO) [LastChromeInstaller] [SkipRebuildArchive] [SetupExeFormat] [DiffAlgorithm]"
Outputs="$(OutDir)/$(InputName).7z;$(OutDir)/$(InputName).packed.7z;$(OutDir)/setup.ex_;$(OutDir)/packed_files.txt;"
AdditionalDependencies="$(SolutionDir)\tools\build\win\create_installer_archive.py;$(OutDir)\chrome.exe;$(OutDir)\crash_reporter.exe;$(OutDir)\chrome.dll;$(OutDir)\locales\en-US.dll;$(OutDir)\icudt38.dll"
FileExtensions="*.release"
diff --git a/tools/gritsettings/resource_ids b/tools/gritsettings/resource_ids
index adc80d4..39aa025 100644
--- a/tools/gritsettings/resource_ids
+++ b/tools/gritsettings/resource_ids
@@ -146,6 +146,9 @@
"chrome/app/theme/theme_resources_2x.grd": {
"includes": [21000],
},
+ "chrome/app/theme/theme_resources_metro_1x.grd": {
+ "includes": [21000],
+ },
# This file is generated during the build.
"chrome/browser/debugger/frontend/devtools_discovery_page_resources.grd": {
"includes": [21500],
diff --git a/ui/base/resource/resource_bundle_win.cc b/ui/base/resource/resource_bundle_win.cc
index 7425755..1a30069 100644
--- a/ui/base/resource/resource_bundle_win.cc
+++ b/ui/base/resource/resource_bundle_win.cc
@@ -9,6 +9,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/resource/resource_data_dll_win.h"
#include "ui/base/win/dpi.h"
+#include "ui/base/win/metro.h"
namespace ui {
@@ -42,12 +43,23 @@ void ResourceBundle::LoadCommonResources() {
use_hidpi_pak = ui::GetDPIScale() > 1.5;
#endif
- if (!use_hidpi_pak) {
- AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak"));
- AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak"));
- } else {
+ bool use_metro_pak = false;
+#if defined(ENABLE_METRO)
+ use_metro_pak = ui::IsInMetroMode();
+#endif
+
+ if (use_metro_pak) {
+ AddDataPack(GetResourcesPakFilePath("theme_resources_metro_1x.pak"));
+ } else if (use_hidpi_pak) {
AddDataPack(GetResourcesPakFilePath("theme_resources_2x.pak"));
+ } else {
+ AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak"));
+ }
+
+ if (use_hidpi_pak) {
AddDataPack(GetResourcesPakFilePath("ui_resources_2x.pak"));
+ } else {
+ AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak"));
}
}
diff --git a/ui/base/win/metro.cc b/ui/base/win/metro.cc
new file mode 100644
index 0000000..1426278
--- /dev/null
+++ b/ui/base/win/metro.cc
@@ -0,0 +1,20 @@
+// 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.
+
+#include "ui/base/win/metro.h"
+
+#include <string>
+#include <windows.h>
+
+namespace ui {
+
+bool IsInMetroMode() {
+ const char* kMetroModeEnvVar = "CHROME_METRO_DLL";
+ char buffer[2];
+ if (!::GetEnvironmentVariableA(kMetroModeEnvVar, buffer, arraysize(buffer)))
+ return false;
+ return buffer == std::string("1");
+}
+
+} // namespace ui
diff --git a/ui/base/win/metro.h b/ui/base/win/metro.h
new file mode 100644
index 0000000..6f7ff87
--- /dev/null
+++ b/ui/base/win/metro.h
@@ -0,0 +1,18 @@
+// 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.
+
+#ifndef UI_BASE_WIN_METRO_H_
+#define UI_BASE_WIN_METRO_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "ui/base/ui_export.h"
+
+namespace ui {
+
+UI_EXPORT bool IsInMetroMode();
+
+} // namespace ui
+
+#endif // UI_BASE_WIN_METRO_H_
diff --git a/ui/ui.gyp b/ui/ui.gyp
index e8089a1..f998b79 100644
--- a/ui/ui.gyp
+++ b/ui/ui.gyp
@@ -259,6 +259,8 @@
'base/win/ime_input.h',
'base/win/message_box_win.cc',
'base/win/message_box_win.h',
+ 'base/win/metro.cc',
+ 'base/win/metro.h',
'base/win/mouse_wheel_util.cc',
'base/win/mouse_wheel_util.h',
'base/win/scoped_ole_initializer.cc',