diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-15 00:19:55 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-15 00:19:55 +0000 |
commit | 1b3deed79fc638d3755ba5159108712238d8beb7 (patch) | |
tree | 285572fcf3283acfb4483f22e7433c3c0c9b0be1 /chrome | |
parent | 173cc090e06c99e15f31fe21d291cd93ba477527 (diff) | |
download | chromium_src-1b3deed79fc638d3755ba5159108712238d8beb7.zip chromium_src-1b3deed79fc638d3755ba5159108712238d8beb7.tar.gz chromium_src-1b3deed79fc638d3755ba5159108712238d8beb7.tar.bz2 |
Make theme change notifications for the renderer originate from the RenderWidgetHostHWND, not the frame.
B=1326392
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@918 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/frame_util.cc | 27 | ||||
-rw-r--r-- | chrome/browser/frame_util.h | 3 | ||||
-rw-r--r-- | chrome/browser/render_view_host.cc | 4 | ||||
-rw-r--r-- | chrome/browser/render_view_host.h | 3 | ||||
-rw-r--r-- | chrome/browser/render_widget_host.cc | 5 | ||||
-rw-r--r-- | chrome/browser/render_widget_host.h | 5 | ||||
-rw-r--r-- | chrome/browser/render_widget_host_hwnd.cc | 4 | ||||
-rw-r--r-- | chrome/browser/render_widget_host_hwnd.h | 2 | ||||
-rw-r--r-- | chrome/browser/vista_frame.cc | 1 | ||||
-rw-r--r-- | chrome/browser/xp_frame.cc | 1 | ||||
-rw-r--r-- | chrome/views/hwnd_view_container.cc | 6 | ||||
-rw-r--r-- | chrome/views/hwnd_view_container.h | 2 |
12 files changed, 26 insertions, 37 deletions
diff --git a/chrome/browser/frame_util.cc b/chrome/browser/frame_util.cc index 85a1b6f..2cad99b 100644 --- a/chrome/browser/frame_util.cc +++ b/chrome/browser/frame_util.cc @@ -156,6 +156,8 @@ bool FrameUtil::LoadAccelerators(BrowserWindow* frame, // static bool FrameUtil::ActivateAppModalDialog(Browser* browser) { + DCHECK(!g_browser_process->IsUsingNewFrames()); + // If another browser is app modal, flash and activate the modal browser. if (BrowserList::IsShowingAppModalDialog()) { if (browser != BrowserList::GetLastActive()) { @@ -199,28 +201,3 @@ void FrameUtil::EndSession() { // down. If any messages are processed we'll likely crash. Exit now. ExitProcess(ResultCodes::NORMAL_EXIT); } - - -// static -void FrameUtil::NotifyTabsOfThemeChange(Browser* browser) { - if (!browser) { - NOTREACHED(); - return; - } - - int tab_count = browser->tab_count(); - for (int tab_index = 0; tab_index < tab_count; ++tab_index) { - TabContents* tab_contents = browser->GetTabContentsAt(tab_index); - DCHECK(tab_contents != NULL); - - WebContents* web_contents = tab_contents->AsWebContents(); - if (!web_contents) { - continue; - } - - RenderViewHost* render_view_host = web_contents->render_view_host(); - if (render_view_host) { - render_view_host->OnThemeChanged(); - } - } -} diff --git a/chrome/browser/frame_util.h b/chrome/browser/frame_util.h index 7b0e2be..74f33ea 100644 --- a/chrome/browser/frame_util.h +++ b/chrome/browser/frame_util.h @@ -68,9 +68,6 @@ class FrameUtil { // this method returns windows is going to kill our process. As such, this // blocks until the shut-down has been marked as clean. static void EndSession(); - - // Notifies all tabs with associated WebContents of theme changes. - static void NotifyTabsOfThemeChange(Browser* browser); }; #endif // #ifndef CHROME_BROWSER_FRAME_UTIL_H__ diff --git a/chrome/browser/render_view_host.cc b/chrome/browser/render_view_host.cc index c37db34..7e9dd5e 100644 --- a/chrome/browser/render_view_host.cc +++ b/chrome/browser/render_view_host.cc @@ -1193,7 +1193,3 @@ void RenderViewHost::OnDebugDisconnect() { } } -void RenderViewHost::OnThemeChanged() { - Send (new ViewMsg_ThemeChanged(routing_id_)); -} - diff --git a/chrome/browser/render_view_host.h b/chrome/browser/render_view_host.h index 7fdbfe0..df158f9 100644 --- a/chrome/browser/render_view_host.h +++ b/chrome/browser/render_view_host.h @@ -395,9 +395,6 @@ class RenderViewHost : public RenderWidgetHost { // and we're necessarily leaving the page. void UnloadListenerHasFired() { has_unload_listener_ = false; } - // Invoked on ui theme changes. - void OnThemeChanged(); - protected: // Overridden from RenderWidgetHost: virtual void UnhandledInputEvent(const WebInputEvent& event); diff --git a/chrome/browser/render_widget_host.cc b/chrome/browser/render_widget_host.cc index 9fcfdd2..2e17806 100644 --- a/chrome/browser/render_widget_host.cc +++ b/chrome/browser/render_widget_host.cc @@ -831,3 +831,8 @@ void RenderWidgetHost::StartHangMonitorTimeout(int delay) { void RenderWidgetHost::RendererExited() { BackingStoreManager::RemoveBackingStore(this); } + +void RenderWidgetHost::SystemThemeChanged() { + Send(new ViewMsg_ThemeChanged(routing_id_)); +} + diff --git a/chrome/browser/render_widget_host.h b/chrome/browser/render_widget_host.h index ceefea1..fc539b6 100644 --- a/chrome/browser/render_widget_host.h +++ b/chrome/browser/render_widget_host.h @@ -225,6 +225,11 @@ class RenderWidgetHost : public IPC::Channel::Listener { // process has gone. void RendererExited(); + // Called when the system theme changes. At this time all existing native + // theme handles are invalid and the renderer must obtain new ones and + // repaint. + void SystemThemeChanged(); + protected: // Called when we an InputEvent was not processed by the renderer. virtual void UnhandledInputEvent(const WebInputEvent& event) { } diff --git a/chrome/browser/render_widget_host_hwnd.cc b/chrome/browser/render_widget_host_hwnd.cc index fb3b2b5..d0adcc3 100644 --- a/chrome/browser/render_widget_host_hwnd.cc +++ b/chrome/browser/render_widget_host_hwnd.cc @@ -510,6 +510,10 @@ void RenderWidgetHostHWND::OnInputLangChange(DWORD character_set, } } +void RenderWidgetHostHWND::OnThemeChanged() { + render_widget_host_->SystemThemeChanged(); +} + LRESULT RenderWidgetHostHWND::OnNotify(int w_param, NMHDR* header) { if (tooltip_hwnd_ == NULL) return 0; diff --git a/chrome/browser/render_widget_host_hwnd.h b/chrome/browser/render_widget_host_hwnd.h index 3121045..18f5d9d 100644 --- a/chrome/browser/render_widget_host_hwnd.h +++ b/chrome/browser/render_widget_host_hwnd.h @@ -104,6 +104,7 @@ class RenderWidgetHostHWND : MSG_WM_CAPTURECHANGED(OnCaptureChanged) MSG_WM_CANCELMODE(OnCancelMode) MSG_WM_INPUTLANGCHANGE(OnInputLangChange) + MSG_WM_THEMECHANGED(OnThemeChanged) MSG_WM_NOTIFY(OnNotify) MESSAGE_HANDLER(WM_IME_SETCONTEXT, OnImeSetContext) MESSAGE_HANDLER(WM_IME_STARTCOMPOSITION, OnImeStartComposition) @@ -173,6 +174,7 @@ class RenderWidgetHostHWND : void OnCaptureChanged(HWND window); void OnCancelMode(); void OnInputLangChange(DWORD character_set, HKL input_language_id); + void OnThemeChanged(); LRESULT OnNotify(int w_param, NMHDR* header); LRESULT OnImeSetContext( UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled); diff --git a/chrome/browser/vista_frame.cc b/chrome/browser/vista_frame.cc index 2a910ff..bdd3dbbd 100644 --- a/chrome/browser/vista_frame.cc +++ b/chrome/browser/vista_frame.cc @@ -712,7 +712,6 @@ BOOL VistaFrame::OnPowerBroadcast(DWORD power_event, DWORD data) { void VistaFrame::OnThemeChanged() { // Notify NativeTheme. gfx::NativeTheme::instance()->CloseHandles(); - FrameUtil::NotifyTabsOfThemeChange(browser_); } void VistaFrame::OnMouseButtonDown(UINT flags, const CPoint& pt) { diff --git a/chrome/browser/xp_frame.cc b/chrome/browser/xp_frame.cc index dadab61..6f21f23 100644 --- a/chrome/browser/xp_frame.cc +++ b/chrome/browser/xp_frame.cc @@ -1499,7 +1499,6 @@ BOOL XPFrame::OnPowerBroadcast(DWORD power_event, DWORD data) { void XPFrame::OnThemeChanged() { // Notify NativeTheme. gfx::NativeTheme::instance()->CloseHandles(); - FrameUtil::NotifyTabsOfThemeChange(browser_); } LRESULT XPFrame::OnAppCommand( diff --git a/chrome/views/hwnd_view_container.cc b/chrome/views/hwnd_view_container.cc index a9649b5..cf1a58a 100644 --- a/chrome/views/hwnd_view_container.cc +++ b/chrome/views/hwnd_view_container.cc @@ -29,6 +29,7 @@ #include "chrome/views/hwnd_view_container.h" +#include "base/gfx/native_theme.h" #include "base/message_loop.h" #include "base/string_util.h" #include "base/win_util.h" @@ -666,6 +667,11 @@ void HWNDViewContainer::OnSize(UINT param, const CSize& size) { ChangeSize(param, size); } +void HWNDViewContainer::OnThemeChanged() { + // Notify NativeTheme. + gfx::NativeTheme::instance()->CloseHandles(); +} + void HWNDViewContainer::OnFinalMessage(HWND window) { if (delete_on_destroy_) delete this; diff --git a/chrome/views/hwnd_view_container.h b/chrome/views/hwnd_view_container.h index 3c792d1..5a13c16 100644 --- a/chrome/views/hwnd_view_container.h +++ b/chrome/views/hwnd_view_container.h @@ -233,6 +233,7 @@ class HWNDViewContainer : public ViewContainer, MSG_WM_SETFOCUS(OnSetFocus) MSG_WM_SIZE(OnSize) MSG_WM_SYSCOMMAND(OnSysCommand) + MSG_WM_THEMECHANGED(OnThemeChanged) MSG_WM_VSCROLL(OnVScroll) MSG_WM_WINDOWPOSCHANGED(OnWindowPosChanged) END_MSG_MAP() @@ -413,6 +414,7 @@ class HWNDViewContainer : public ViewContainer, virtual LRESULT OnSettingChange(UINT msg, WPARAM w_param, LPARAM l_param); virtual void OnSize(UINT param, const CSize& size); virtual void OnSysCommand(UINT notification_code, CPoint click) { } + virtual void OnThemeChanged(); virtual void OnVScroll(int scroll_type, short position, HWND scrollbar) { SetMsgHandled(FALSE); } |