1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_WEB_APP_ICON_MANAGER_H__
6 #define CHROME_BROWSER_WEB_APP_ICON_MANAGER_H__
10 #include "base/scoped_ptr.h"
11 #include "chrome/browser/web_app.h"
15 // WebAppIconManager is used by SimpleXPFrame/SimpleVistaFrame to manage the
16 // icons for the frame. If the current contents are a web app, then icon is
17 // set from the app, otherwise the icons are set to the default.
18 class WebAppIconManager
: public WebApp::Observer
{
20 explicit WebAppIconManager(HWND parent
);
23 // Sets the contents the WebApp should come from. If the contents has a web
24 // app, the image comes from it, otherwise the icon for the HWND is set to
25 // the default chrome icon.
26 void SetContents(TabContents
* contents
);
28 // Enables/disables icons. If true and this WebAppIconManager was previously
29 // disabled, the icon is updated immediately.
30 void SetUpdatesEnabled(bool enabled
);
33 // Invoked when the icons of the WebApp has changed. Invokes
34 // UpdateIconsFromApp appropriately.
35 virtual void WebAppImagesChanged(WebApp
* web_app
);
37 // Updates the icons of the HWND, unless we're disabled in which case this
39 void UpdateIconsFromApp();
41 // HWND the icon is updated on.
44 // Current app, may be null.
45 scoped_refptr
<WebApp
> app_
;
47 // Icons. These are only valid if the app doesn't have an icon.
51 // Are we enabled? If not, we won't update the icons of the HWND.
54 DISALLOW_EVIL_CONSTRUCTORS(WebAppIconManager
);
57 #endif // CHROME_BROWSER_WEB_APP_ICON_MANAGER_H__