| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_WEB_APP_ICON_MANAGER_H__ | |
| 6 #define CHROME_BROWSER_WEB_APP_ICON_MANAGER_H__ | |
| 7 | |
| 8 #include <windows.h> | |
| 9 | |
| 10 #include "base/scoped_ptr.h" | |
| 11 #include "chrome/browser/web_app.h" | |
| 12 | |
| 13 class TabContents; | |
| 14 | |
| 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(); | |
| 22 | |
| 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); | |
| 27 | |
| 28 // Enables/disables icons. If true and this WebAppIconManager was previously | |
| 29 // disabled, the icon is updated immediately. | |
| 30 void SetUpdatesEnabled(bool enabled); | |
| 31 | |
| 32 private: | |
| 33 // Invoked when the icons of the WebApp has changed. Invokes | |
| 34 // UpdateIconsFromApp appropriately. | |
| 35 virtual void WebAppImagesChanged(WebApp* web_app); | |
| 36 | |
| 37 // Updates the icons of the HWND, unless we're disabled in which case this | |
| 38 // does nothing. | |
| 39 void UpdateIconsFromApp(); | |
| 40 | |
| 41 // HWND the icon is updated on. | |
| 42 const HWND hwnd_; | |
| 43 | |
| 44 // Current app, may be null. | |
| 45 scoped_refptr<WebApp> app_; | |
| 46 | |
| 47 // Icons. These are only valid if the app doesn't have an icon. | |
| 48 HICON small_icon_; | |
| 49 HICON big_icon_; | |
| 50 | |
| 51 // Are we enabled? If not, we won't update the icons of the HWND. | |
| 52 bool enabled_; | |
| 53 | |
| 54 DISALLOW_EVIL_CONSTRUCTORS(WebAppIconManager); | |
| 55 }; | |
| 56 | |
| 57 #endif // CHROME_BROWSER_WEB_APP_ICON_MANAGER_H__ | |
| 58 | |
| OLD | NEW |