diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 02:24:18 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 02:24:18 +0000 |
commit | 8973c3a2aa49807495c55cb8ff6e2e7b31621eaf (patch) | |
tree | 3cd138dc8854e3e45b6cbc8933787d1598a3d4de /ui/base | |
parent | 42d194d32e7c310414769a11e7eae3381ff90abf (diff) | |
download | chromium_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
Diffstat (limited to 'ui/base')
-rw-r--r-- | ui/base/resource/resource_bundle_win.cc | 20 | ||||
-rw-r--r-- | ui/base/win/metro.cc | 20 | ||||
-rw-r--r-- | ui/base/win/metro.h | 18 |
3 files changed, 54 insertions, 4 deletions
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_ |