OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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_SIDEBAR_SIDEBAR_MODEL_H_ |
| 6 #define CHROME_BROWSER_SIDEBAR_SIDEBAR_MODEL_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/string16.h" |
| 12 |
| 13 class GURL; |
| 14 class SidebarContainer; |
| 15 class SkBitmap; |
| 16 class TabContentsWrapper; |
| 17 |
| 18 // SidebarModel is a Chrome sidebar abstraction, it represents a connection |
| 19 // between page tabs and sidebars defined for them. |
| 20 // Provides an API for sidebar state enquires and manipulations, including |
| 21 // functions backing chrome.experimental.sidebar API. |
| 22 class SidebarModel { |
| 23 public: |
| 24 virtual ~SidebarModel() {} |
| 25 |
| 26 // Returns all sidebars defined for |tab| at once. |
| 27 virtual std::vector<SidebarContainer*> GetAllSidebarsFor( |
| 28 TabContentsWrapper* tab) = 0; |
| 29 |
| 30 // Returns SidebarContainer registered for |tab| and active or NULL if |
| 31 // there is no alive and active SidebarContainer registered for |tab|. |
| 32 virtual SidebarContainer* GetActiveSidebarContainerFor( |
| 33 TabContentsWrapper* tab) = 0; |
| 34 |
| 35 // Returns SidebarContainer registered for |tab| and |content_id| or NULL if |
| 36 // there is no such SidebarContainer registered. |
| 37 virtual SidebarContainer* GetSidebarContainerFor( |
| 38 TabContentsWrapper* tab, |
| 39 const std::string& content_id) = 0; |
| 40 |
| 41 // Returns sidebar's TabContents registered for |tab| and |content_id|. |
| 42 virtual TabContents* GetSidebarTabContents(TabContentsWrapper* tab, |
| 43 const std::string& content_id) = 0; |
| 44 |
| 45 // Sends sidebar state change notification to extensions. |
| 46 virtual void NotifyStateChanges(TabContents* was_active_sidebar_contents, |
| 47 TabContents* active_sidebar_contents) = 0; |
| 48 |
| 49 // Expands/collapses sidebar identified by |tab| and |content_id|, |
| 50 // depending on its current state (has no effect if sidebar is |
| 51 // not shown). |
| 52 virtual void ToggleSidebar(TabContentsWrapper* tab, |
| 53 const std::string& content_id) = 0; |
| 54 |
| 55 // Functions supporting chrome.experimental.sidebar API. |
| 56 |
| 57 // Shows sidebar identified by |tab| and |content_id| (only sidebar's |
| 58 // mini tab is visible). |
| 59 virtual void ShowSidebar(TabContentsWrapper* tab, |
| 60 const std::string& content_id) = 0; |
| 61 |
| 62 // Expands sidebar identified by |tab| and |content_id|. |
| 63 virtual void ExpandSidebar(TabContentsWrapper* tab, |
| 64 const std::string& content_id) = 0; |
| 65 |
| 66 // Collapses sidebar identified by |tab| and |content_id| (has no effect |
| 67 // if sidebar is not expanded). |
| 68 virtual void CollapseSidebar(TabContentsWrapper* tab, |
| 69 const std::string& content_id) = 0; |
| 70 |
| 71 // Hides sidebar identified by |tab| and |content_id| (removes sidebar's |
| 72 // mini tab). |
| 73 virtual void HideSidebar(TabContentsWrapper* tab, |
| 74 const std::string& content_id) = 0; |
| 75 |
| 76 // Navigates sidebar identified by |tab| and |content_id| to |url|. |
| 77 virtual void NavigateSidebar(TabContentsWrapper* tab, |
| 78 const std::string& content_id, |
| 79 const GURL& url) = 0; |
| 80 |
| 81 // Changes sidebar's badge text (displayed on the mini tab). |
| 82 virtual void SetSidebarBadgeText(TabContentsWrapper* tab, |
| 83 const std::string& content_id, |
| 84 const string16& badge_text) = 0; |
| 85 |
| 86 // Changes sidebar's icon (displayed on the mini tab). |
| 87 virtual void SetSidebarIcon(TabContentsWrapper* tab, |
| 88 const std::string& content_id, |
| 89 const SkBitmap& bitmap) = 0; |
| 90 |
| 91 // Changes sidebar's title (mini tab's tooltip). |
| 92 virtual void SetSidebarTitle(TabContentsWrapper* tab, |
| 93 const std::string& content_id, |
| 94 const string16& title) = 0; |
| 95 }; |
| 96 |
| 97 #endif // CHROME_BROWSER_SIDEBAR_SIDEBAR_MODEL_H_ |
| 98 |
OLD | NEW |