summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-06 19:25:16 +0000
committercpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-06 19:25:16 +0000
commit91b7d87237f8b0505d7e0e9fe10e30abe1e43b97 (patch)
tree737d2e284ffd763f329f5758130bbfb3f239a508
parent4b0f9635f09dd8db54d6e4e699c7bc20c4aaebee (diff)
downloadchromium_src-91b7d87237f8b0505d7e0e9fe10e30abe1e43b97.zip
chromium_src-91b7d87237f8b0505d7e0e9fe10e30abe1e43b97.tar.gz
chromium_src-91b7d87237f8b0505d7e0e9fe10e30abe1e43b97.tar.bz2
Get visual theme support for renderers
- Removing COm initialization broke it - COM creates a hidden window so that was the trick TEST= using windows XP with luna theme enabled, go to a page that has a form with buttons, for example gmail.com. Observe the buttonsb being rounded flat, like the theme and not square and 3d. BUG=http://code.google.com/p/chromium/issues/detail?id=11292 Review URL: http://codereview.chromium.org/113042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15441 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/renderer_main_platform_delegate_win.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/renderer/renderer_main_platform_delegate_win.cc b/chrome/renderer/renderer_main_platform_delegate_win.cc
index 743fc63..cc5e2be 100644
--- a/chrome/renderer/renderer_main_platform_delegate_win.cc
+++ b/chrome/renderer/renderer_main_platform_delegate_win.cc
@@ -5,11 +5,32 @@
#include "chrome/renderer/renderer_main_platform_delegate.h"
#include "base/command_line.h"
+#include "base/gfx/native_theme.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/injection_test_dll.h"
#include "sandbox/src/sandbox.h"
+namespace {
+
+// In order to have Theme support, we need to connect to the theme service.
+// This needs to be done before we lock down the renderer. Officially this
+// can be done with OpenThemeData() but it fails unless you pass a valid
+// window at least the first time. Interestingly, the very act of creating a
+// window also sets the connection to the theme service.
+void EnableThemeSupportForRenderer() {
+ HWND window = ::CreateWindowExW(0, L"Static", L"", WS_POPUP | WS_DISABLED,
+ CW_USEDEFAULT, 0, 0, 0, HWND_MESSAGE, NULL,
+ ::GetModuleHandleA(NULL), NULL);
+ if (!window) {
+ DLOG(WARNING) << "failed to enable theme support";
+ return;
+ }
+ ::DestroyWindow(window);
+}
+
+} // namespace
+
RendererMainPlatformDelegate::RendererMainPlatformDelegate(
const MainFunctionParams& parameters)
: parameters_(parameters),
@@ -22,6 +43,7 @@ RendererMainPlatformDelegate::~RendererMainPlatformDelegate() {
void RendererMainPlatformDelegate::PlatformInitialize() {
// Be mindful of what resources you acquire here. They can be used by
// malicious code if the renderer gets compromised.
+ EnableThemeSupportForRenderer();
}
void RendererMainPlatformDelegate::PlatformUninitialize() {