Chromium Code Reviews| Index: chrome/browser/icon_delegate.h |
| diff --git a/chrome/browser/icon_delegate.h b/chrome/browser/icon_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6fa49174b9be3f722152850d5dae5ffb53d95d9c |
| --- /dev/null |
| +++ b/chrome/browser/icon_delegate.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_ICON_DELEGATE_H__ |
| +#define CHROME_BROWSER_ICON_DELEGATE_H__ |
| +#pragma once |
| + |
| +#include "chrome/browser/history/history_types.h" |
| + |
| +class NavigationEntry; |
| + |
| +// IconDelegate is a interface should be implemented for a type of icon to |
| +// handle to update the favicon data in NavigationEntry, provide the size for a |
| +// type of icon or convert image to specific size. |
| +class IconDelegate { |
| + public: |
| + IconDelegate() {} |
| + virtual ~IconDelegate() {} |
| + |
| + // Updates the image data in NavigationEntry only if the image data is not |
| + // valid and the given url is same as the one in NavigationEntry's favicon |
| + // status. |
| + virtual void UpdateFaviconImageData(NavigationEntry* entry, |
|
sky
2011/03/18 17:33:37
I was hoping a delegate interface would allow Favi
|
| + const GURL& url, |
| + scoped_refptr<RefCountedMemory> data) = 0; |
| + |
| + // Converts the image data to an SkBitmap and sets it on the NavigationEntry. |
| + // If the TabContents has a delegate, it is notified of the new favicon |
| + // (INVALIDATE_FAVICON). |
| + virtual void UpdateFaviconImageData(NavigationEntry* entry, |
| + scoped_refptr<RefCountedMemory> data); |
| + |
| + virtual void UpdateFaviconImageData(NavigationEntry* entry, |
| + const SkBitmap& image) = 0; |
| + |
| + // Updates the favicon url in NavigationEntry's favicon with the given url. |
| + virtual void UpdateFaviconURL(NavigationEntry* entry, const GURL& url) = 0; |
| + |
| + // Converts downloaded icon before save to history DB and update to |
| + // NavigationEntry. |
| + virtual SkBitmap ConvertToFaviconSize(const SkBitmap& image) = 0; |
| + |
| + // Returns the preferred icon size. |
| + virtual int GetIconSize() = 0; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(IconDelegate); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_ICON_DELEGATE_H__ |