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
This commit is contained in:
chrome
@ -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 {
|
||||
|
@ -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.
|
||||
|
@ -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:
|
||||
|
@ -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,
|
||||
|
@ -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_; }
|
||||
|
||||
|
Reference in New Issue
Block a user