summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
authorbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-09 01:18:15 +0000
committerbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-09 01:18:15 +0000
commite724cb43e666972363380de0f6eba349160ac28c (patch)
treea6624020ce21fcfe3756f845c0b103ac94c602ff /chrome/views
parent5982bb05e7c927b6384785ae84970ade1b73912a (diff)
downloadchromium_src-e724cb43e666972363380de0f6eba349160ac28c.zip
chromium_src-e724cb43e666972363380de0f6eba349160ac28c.tar.gz
chromium_src-e724cb43e666972363380de0f6eba349160ac28c.tar.bz2
Allow the window icon to be shown in the task bar, Alt+Tab etc.
B=1031854 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@614 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r--chrome/views/custom_frame_window.cc7
-rw-r--r--chrome/views/custom_frame_window.h1
-rw-r--r--chrome/views/window.cc12
-rw-r--r--chrome/views/window.h3
4 files changed, 23 insertions, 0 deletions
diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc
index 08f8e6d..711ccc8 100644
--- a/chrome/views/custom_frame_window.cc
+++ b/chrome/views/custom_frame_window.cc
@@ -889,6 +889,13 @@ void CustomFrameWindow::UpdateWindowTitle() {
Window::UpdateWindowTitle();
}
+void CustomFrameWindow::UpdateWindowIcon() {
+ // The icon will be re-validated during painting.
+ non_client_view_->SchedulePaint();
+ // Call the base class so that places like the Task Bar get updated.
+ Window::UpdateWindowIcon();
+}
+
void CustomFrameWindow::EnableClose(bool enable) {
non_client_view_->EnableClose(enable);
// Make sure the SysMenu changes to reflect this change as well.
diff --git a/chrome/views/custom_frame_window.h b/chrome/views/custom_frame_window.h
index b94cde3..b540de0 100644
--- a/chrome/views/custom_frame_window.h
+++ b/chrome/views/custom_frame_window.h
@@ -67,6 +67,7 @@ class CustomFrameWindow : public Window {
virtual gfx::Size CalculateWindowSizeForClientSize(
const gfx::Size& client_size) const;
virtual void UpdateWindowTitle();
+ virtual void UpdateWindowIcon();
protected:
// Overridden from Window:
diff --git a/chrome/views/window.cc b/chrome/views/window.cc
index 086c69b..66f3f93 100644
--- a/chrome/views/window.cc
+++ b/chrome/views/window.cc
@@ -32,6 +32,7 @@
#include "chrome/app/chrome_dll_resource.h"
// TODO(beng): some day make this unfortunate dependency not exist.
#include "chrome/browser/browser_list.h"
+#include "chrome/common/gfx/icon_util.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/resource_bundle.h"
@@ -182,6 +183,17 @@ void Window::UpdateWindowTitle() {
SetWindowText(GetHWND(), window_title.c_str());
}
+void Window::UpdateWindowIcon() {
+ SkBitmap icon = window_delegate_->GetWindowIcon();
+ if (!icon.isNull()) {
+ HICON windows_icon = IconUtil::CreateHICONFromSkBitmap(icon);
+ SendMessage(GetHWND(), WM_SETICON, ICON_SMALL,
+ reinterpret_cast<LPARAM>(windows_icon));
+ SendMessage(GetHWND(), WM_SETICON, ICON_BIG,
+ reinterpret_cast<LPARAM>(windows_icon));
+ }
+}
+
// static
bool Window::SaveWindowPositionToPrefService(PrefService* pref_service,
const std::wstring& entry,
diff --git a/chrome/views/window.h b/chrome/views/window.h
index d098938..c7686c3 100644
--- a/chrome/views/window.h
+++ b/chrome/views/window.h
@@ -112,6 +112,9 @@ class Window : public HWNDViewContainer {
// Tell the window to update its title from the delegate.
virtual void UpdateWindowTitle();
+ // Tell the window to update its icon from the delegate.
+ virtual void UpdateWindowIcon();
+
// The parent of this window.
HWND owning_window() const { return owning_hwnd_; }