summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/frame/browser_view2.cc18
-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
5 files changed, 33 insertions, 8 deletions
diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc
index 7163686..076faa0 100644
--- a/chrome/browser/views/frame/browser_view2.cc
+++ b/chrome/browser/views/frame/browser_view2.cc
@@ -217,6 +217,7 @@ void BrowserView2::SelectedTabToolbarSizeChanged(bool is_animating) {
void BrowserView2::UpdateTitleBar() {
frame_->GetWindow()->UpdateWindowTitle();
+ frame_->GetWindow()->UpdateWindowIcon();
}
void BrowserView2::SetWindowTitle(const std::wstring& title) {
@@ -419,10 +420,8 @@ void BrowserView2::TabSelectedAt(TabContents* old_contents,
if (BrowserList::GetLastActive() == browser_)
new_contents->RestoreFocus();
- /*
- UpdateWindowTitle();
- UpdateToolbar(true);
- */
+ UpdateTitleBar();
+ // UpdateToolbar(true);
UpdateUIForContents(new_contents);
}
@@ -467,10 +466,13 @@ bool BrowserView2::ShouldShowWindowTitle() const {
}
SkBitmap BrowserView2::GetWindowIcon() {
- SkBitmap favicon = browser_->GetCurrentPageIcon();
- if (favicon.isNull())
- return default_favicon_;
- return favicon;
+ if (browser_->GetType() == BrowserType::APPLICATION) {
+ SkBitmap favicon = browser_->GetCurrentPageIcon();
+ if (favicon.isNull())
+ return default_favicon_;
+ return favicon;
+ }
+ return SkBitmap();
}
bool BrowserView2::ShouldShowWindowIcon() const {
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_; }