Fixing build: GetViewContainer changed name from under me. :)
[chromium-blink-merge.git] / chrome / browser / web_app_icon_manager.h
blob3f8d2454cc4a127b24bcc59e3a978d7a99e45113
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__
8 #include <windows.h>
10 #include "base/scoped_ptr.h"
11 #include "chrome/browser/web_app.h"
13 class TabContents;
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 {
19 public:
20 explicit WebAppIconManager(HWND parent);
21 ~WebAppIconManager();
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);
32 private:
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
38 // does nothing.
39 void UpdateIconsFromApp();
41 // HWND the icon is updated on.
42 const HWND hwnd_;
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.
48 HICON small_icon_;
49 HICON big_icon_;
51 // Are we enabled? If not, we won't update the icons of the HWND.
52 bool enabled_;
54 DISALLOW_EVIL_CONSTRUCTORS(WebAppIconManager);
57 #endif // CHROME_BROWSER_WEB_APP_ICON_MANAGER_H__