15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_TOOLBAR_BACK_FORWARD_MENU_MODEL_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_TOOLBAR_BACK_FORWARD_MENU_MODEL_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <set> 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string> 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h" 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/gtest_prod_util.h" 13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/string16.h" 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/favicon/favicon_service.h" 152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/common/cancelable_task_tracker.h" 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/base/models/menu_model.h" 172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/base/window_open_disposition.h" 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Browser; 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace chrome { 2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)struct FaviconImageResult; 2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content { 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class NavigationEntry; 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class WebContents; 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace gfx { 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Image; 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/////////////////////////////////////////////////////////////////////////////// 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// BackForwardMenuModel 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Interface for the showing of the dropdown menu for the Back/Forward buttons. 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Actual implementations are platform-specific. 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/////////////////////////////////////////////////////////////////////////////// 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BackForwardMenuModel : public ui::MenuModel { 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // These are IDs used to identify individual UI elements within the 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // browser window using View::GetViewByID. 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) enum ModelType { 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) FORWARD_MENU = 1, 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BACKWARD_MENU = 2 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) }; 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BackForwardMenuModel(Browser* browser, ModelType model_type); 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ~BackForwardMenuModel(); 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // MenuModel implementation. 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool HasIcons() const OVERRIDE; 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns how many items the menu should show, including history items, 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // chapter-stops, separators and the Show Full History link. This function 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // uses GetHistoryItemCount() and GetChapterStopCount() internally to figure 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // out the total number of items to show. 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual int GetItemCount() const OVERRIDE; 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ItemType GetTypeAt(int index) const OVERRIDE; 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const OVERRIDE; 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual int GetCommandIdAt(int index) const OVERRIDE; 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual string16 GetLabelAt(int index) const OVERRIDE; 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool IsItemDynamicAt(int index) const OVERRIDE; 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool GetAcceleratorAt(int index, 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ui::Accelerator* accelerator) const OVERRIDE; 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool IsItemCheckedAt(int index) const OVERRIDE; 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual int GetGroupIdAt(int index) const OVERRIDE; 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool GetIconAt(int index, gfx::Image* icon) OVERRIDE; 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int index) const OVERRIDE; 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool IsEnabledAt(int index) const OVERRIDE; 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void HighlightChangedTo(int index) OVERRIDE; 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void ActivatedAt(int index) OVERRIDE; 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void ActivatedAt(int index, int event_flags) OVERRIDE; 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void MenuWillShow() OVERRIDE; 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Is the item at |index| a separator? 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsSeparator(int index) const; 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Set the delegate for triggering OnIconChanged. 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void SetMenuModelDelegate( 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ui::MenuModelDelegate* menu_model_delegate) OVERRIDE; 852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual ui::MenuModelDelegate* GetMenuModelDelegate() const OVERRIDE; 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected: 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ui::MenuModelDelegate* menu_model_delegate() { return menu_model_delegate_; } 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private: 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) friend class BackFwdMenuModelTest; 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, BasicCase); 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, MaxItemsTest); 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, ChapterStops); 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, EscapeLabel); 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, FaviconLoadTest); 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Requests a favicon from the FaviconService. Called by GetIconAt if the 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // NavigationEntry has an invalid favicon. 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void FetchFavicon(content::NavigationEntry* entry); 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Callback from the favicon service. 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void OnFavIconDataAvailable( 1042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int navigation_entry_unique_id, 10590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const chrome::FaviconImageResult& image_result); 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Allows the unit test to use its own dummy tab contents. 1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void set_test_web_contents(content::WebContents* test_web_contents) { 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) test_web_contents_ = test_web_contents; 1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns how many history items the menu should show. For example, if the 1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // navigation controller of the current tab has a current entry index of 5 and 1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // forward_direction_ is false (we are the back button delegate) then this 1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // function will return 5 (representing 0-4). If forward_direction_ is 1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // true (we are the forward button delegate), then this function will return 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the number of entries after 5. Note, though, that in either case it will 1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // not report more than kMaxHistoryItems. The number returned also does not 1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // include the separator line after the history items (nor the separator for 1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the "Show Full History" link). 1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int GetHistoryItemCount() const; 1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns how many chapter-stop items the menu should show. For the 1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // definition of a chapter-stop, see GetIndexOfNextChapterStop(). The number 1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // returned does not include the separator lines before and after the 1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // chapter-stops. 1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int GetChapterStopCount(int history_items) const; 1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Finds the next chapter-stop in the NavigationEntryList starting from 1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the index specified in |start_from| and continuing in the direction 1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // specified (|forward|) until either a chapter-stop is found or we reach the 1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // end, in which case -1 is returned. If |start_from| is out of bounds, -1 1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // will also be returned. A chapter-stop is defined as the last page the user 1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // browsed to within the same domain. For example, if the user's homepage is 1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Google and she navigates to Google pages G1, G2 and G3 before heading over 1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // to WikiPedia for pages W1 and W2 and then back to Google for pages G4 and 1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // G5 then G3, W2 and G5 are considered chapter-stops. The return value from 1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // this function is an index into the NavigationEntryList vector. 1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int GetIndexOfNextChapterStop(int start_from, bool forward) const; 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Finds a given chapter-stop starting at the currently active entry in the 1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // NavigationEntryList vector advancing first forward or backward by |offset| 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // (depending on the direction specified in parameter |forward|). It also 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // allows you to skip chapter-stops by specifying a positive value for |skip|. 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Example: FindChapterStop(5, false, 3) starts with the currently active 1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // index, subtracts 5 from it and then finds the fourth chapter-stop before 1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // that index (skipping the first 3 it finds). 1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Example: FindChapterStop(0, true, 0) is functionally equivalent to 1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // calling GetIndexOfNextChapterStop(GetCurrentEntryIndex(), true). 1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // NOTE: Both |offset| and |skip| must be non-negative. The return value from 1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // this function is an index into the NavigationEntryList vector. If |offset| 1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // is out of bounds or if we skip too far (run out of chapter-stops) this 1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // function returns -1. 1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int FindChapterStop(int offset, bool forward, int skip) const; 1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // How many items (max) to show in the back/forward history menu dropdown. 1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) static const int kMaxHistoryItems; 1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // How many chapter-stops (max) to show in the back/forward dropdown list. 1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) static const int kMaxChapterStops; 1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Takes a menu item index as passed in through one of the menu delegate 1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // functions and converts it into an index into the NavigationEntryList 1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // vector. |index| can point to a separator, or the 1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // "Show Full History" link in which case this function returns -1. 1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int MenuIndexToNavEntryIndex(int index) const; 1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Does the item have a command associated with it? 1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool ItemHasCommand(int index) const; 1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if there is an icon for this menu item. 1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool ItemHasIcon(int index) const; 1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Allow the unit test to use the "Show Full History" label. 1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) string16 GetShowFullHistoryLabel() const; 1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Looks up a NavigationEntry by menu id. 1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) content::NavigationEntry* GetNavigationEntry(int index) const; 1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Retrieves the WebContents pointer to use, which is either the one that 1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the unit test sets (using set_test_web_contents) or the one from 1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the browser window. 1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) content::WebContents* GetWebContents() const; 1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Build a string version of a user action on this menu, used as an 1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // identifier for logging user behavior. 1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // E.g. BuildActionName("Click", 2) returns "BackMenu_Click2". 1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // An index of -1 means no index. 1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::string BuildActionName(const std::string& name, int index) const; 1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Browser* browser_; 1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The unit tests will provide their own WebContents to use. 1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) content::WebContents* test_web_contents_; 1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Represents whether this is the delegate for the forward button or the 1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // back button. 1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ModelType model_type_; 2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Keeps track of which favicons have already been requested from the history 2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // to prevent duplicate requests, identified by 2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // NavigationEntry->GetUniqueID(). 2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::set<int> requested_favicons_; 2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Used for loading favicons. 2072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) CancelableTaskTracker cancelable_task_tracker_; 2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used for receiving notifications when an icon is changed. 2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ui::MenuModelDelegate* menu_model_delegate_; 2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(BackForwardMenuModel); 2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CHROME_BROWSER_UI_TOOLBAR_BACK_FORWARD_MENU_MODEL_H_ 216