| Index: chrome/browser/ui/toolbar/back_forward_menu_model.h
|
| ===================================================================
|
| --- chrome/browser/ui/toolbar/back_forward_menu_model.h (revision 70486)
|
| +++ chrome/browser/ui/toolbar/back_forward_menu_model.h (working copy)
|
| @@ -6,12 +6,14 @@
|
| #define CHROME_BROWSER_UI_TOOLBAR_BACK_FORWARD_MENU_MODEL_H_
|
| #pragma once
|
|
|
| +#include <set>
|
| #include <string>
|
|
|
| #include "app/menus/menu_model.h"
|
| #include "base/basictypes.h"
|
| #include "base/gtest_prod_util.h"
|
| #include "base/string16.h"
|
| +#include "chrome/browser/favicon_service.h"
|
| #include "webkit/glue/window_open_disposition.h"
|
|
|
| class Browser;
|
| @@ -53,7 +55,7 @@
|
| menus::Accelerator* accelerator) const;
|
| virtual bool IsItemCheckedAt(int index) const;
|
| virtual int GetGroupIdAt(int index) const;
|
| - virtual bool GetIconAt(int index, SkBitmap* icon) const;
|
| + virtual bool GetIconAt(int index, SkBitmap* icon);
|
| virtual menus::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const;
|
| virtual bool IsEnabledAt(int index) const;
|
| virtual MenuModel* GetSubmenuModelAt(int index) const;
|
| @@ -65,7 +67,19 @@
|
| // Is the item at |index| a separator?
|
| bool IsSeparator(int index) const;
|
|
|
| + // Set the delegate for triggering OnIconChanged.
|
| + virtual void SetDelegate(Delegate* delegate);
|
| +
|
| private:
|
| + // Requests a favicon from the FaviconService. Called by GetIconAt if the
|
| + // NavigationEntry has an invalid favicon.
|
| + void FetchFavicon(NavigationEntry* entry, int index);
|
| + // Callback from the favicon service.
|
| + void OnFavIconDataAvailable(FaviconService::Handle handle,
|
| + bool know_favicon,
|
| + scoped_refptr<RefCountedMemory> data,
|
| + bool expired,
|
| + GURL icon_url);
|
| // Allows the unit test to use its own dummy tab contents.
|
| void set_test_tab_contents(TabContents* test_tab_contents) {
|
| test_tab_contents_ = test_tab_contents;
|
| @@ -160,11 +174,22 @@
|
| // back button.
|
| ModelType model_type_;
|
|
|
| + // Keeps track of which favicons have already been requested from the history
|
| + // to prevent duplicate requests, identified by NavigationEntry->unique_id().
|
| + std::set<int> requested_favicons_;
|
| +
|
| + // Delegate from menus::MenuModel so we can trigger OnIconChanged.
|
| + Delegate* delegate_;
|
| +
|
| friend class BackFwdMenuModelTest;
|
| FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, BasicCase);
|
| FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, MaxItemsTest);
|
| FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, ChapterStops);
|
| + FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, FaviconLoadTest);
|
|
|
| + // Used for loading favicons from history.
|
| + CancelableRequestConsumerTSimple<int> load_consumer_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(BackForwardMenuModel);
|
| };
|
|
|
|
|