| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_TABS_TAB_STRIP_MODEL_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_TABS_TAB_STRIP_MODEL_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_DELEGATE_H_ | 6 #define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace gfx { | 22 namespace gfx { |
| 23 class Rect; | 23 class Rect; |
| 24 } | 24 } |
| 25 | 25 |
| 26 /////////////////////////////////////////////////////////////////////////////// | 26 /////////////////////////////////////////////////////////////////////////////// |
| 27 // | 27 // |
| 28 // TabStripModelDelegate | 28 // TabStripModelDelegate |
| 29 // | 29 // |
| 30 // A delegate interface that the TabStripModel uses to perform work that it | 30 // A delegate interface that the TabStripModel uses to perform work that it |
| 31 // can't do itself, such as obtain a container HWND for creating new | 31 // can't do itself, such as obtain a container HWND for creating new |
| 32 // TabContents, creating new TabStripModels for detached tabs, etc. | 32 // TabContentsWrappers, creating new TabStripModels for detached tabs, etc. |
| 33 // | 33 // |
| 34 // This interface is typically implemented by the controller that instantiates | 34 // This interface is typically implemented by the controller that instantiates |
| 35 // the TabStripModel (in our case the Browser object). | 35 // the TabStripModel (in our case the Browser object). |
| 36 // | 36 // |
| 37 /////////////////////////////////////////////////////////////////////////////// | 37 /////////////////////////////////////////////////////////////////////////////// |
| 38 class TabStripModelDelegate { | 38 class TabStripModelDelegate { |
| 39 public: | 39 public: |
| 40 enum { | 40 enum { |
| 41 TAB_MOVE_ACTION = 1, | 41 TAB_MOVE_ACTION = 1, |
| 42 TAB_TEAROFF_ACTION = 2 | 42 TAB_TEAROFF_ACTION = 2 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 53 // representing the newly created window and tab strip. This does not | 53 // representing the newly created window and tab strip. This does not |
| 54 // show the window, it's up to the caller to do so. | 54 // show the window, it's up to the caller to do so. |
| 55 virtual Browser* CreateNewStripWithContents(TabContentsWrapper* contents, | 55 virtual Browser* CreateNewStripWithContents(TabContentsWrapper* contents, |
| 56 const gfx::Rect& window_bounds, | 56 const gfx::Rect& window_bounds, |
| 57 const DockInfo& dock_info, | 57 const DockInfo& dock_info, |
| 58 bool maximize) = 0; | 58 bool maximize) = 0; |
| 59 | 59 |
| 60 // Determines what drag actions are possible for the specified strip. | 60 // Determines what drag actions are possible for the specified strip. |
| 61 virtual int GetDragActions() const = 0; | 61 virtual int GetDragActions() const = 0; |
| 62 | 62 |
| 63 // Creates an appropriate TabContents for the given URL. This is handled by | 63 // Creates an appropriate TabContentsWrapper for the given URL. This is |
| 64 // the delegate since the TabContents may require special circumstances to | 64 // handled by the delegate since the TabContentsWrapper may require special |
| 65 // exist for it to be constructed (e.g. a parent HWND). | 65 // circumstances to exist for it to be constructed (e.g. a parent HWND). |
| 66 // If |defer_load| is true, the navigation controller doesn't load the url. | 66 // If |defer_load| is true, the navigation controller doesn't load the url. |
| 67 // If |instance| is not null, its process is used to render the tab. | 67 // If |instance| is not null, its process is used to render the tab. |
| 68 virtual TabContentsWrapper* CreateTabContentsForURL( | 68 virtual TabContentsWrapper* CreateTabContentsForURL( |
| 69 const GURL& url, | 69 const GURL& url, |
| 70 const content::Referrer& referrer, | 70 const content::Referrer& referrer, |
| 71 Profile* profile, | 71 Profile* profile, |
| 72 content::PageTransition transition, | 72 content::PageTransition transition, |
| 73 bool defer_load, | 73 bool defer_load, |
| 74 content::SiteInstance* instance) const = 0; | 74 content::SiteInstance* instance) const = 0; |
| 75 | 75 |
| 76 // Returns whether some contents can be duplicated. | 76 // Returns whether some contents can be duplicated. |
| 77 virtual bool CanDuplicateContentsAt(int index) = 0; | 77 virtual bool CanDuplicateContentsAt(int index) = 0; |
| 78 | 78 |
| 79 // Duplicates the contents at the provided index and places it into its own | 79 // Duplicates the contents at the provided index and places it into its own |
| 80 // window. | 80 // window. |
| 81 virtual void DuplicateContentsAt(int index) = 0; | 81 virtual void DuplicateContentsAt(int index) = 0; |
| 82 | 82 |
| 83 // Called when a drag session has completed and the frame that initiated the | 83 // Called when a drag session has completed and the frame that initiated the |
| 84 // the session should be closed. | 84 // the session should be closed. |
| 85 virtual void CloseFrameAfterDragSession() = 0; | 85 virtual void CloseFrameAfterDragSession() = 0; |
| 86 | 86 |
| 87 // Creates an entry in the historical tab database for the specified | 87 // Creates an entry in the historical tab database for the specified |
| 88 // TabContents. | 88 // TabContentsWrapper. |
| 89 virtual void CreateHistoricalTab(TabContentsWrapper* contents) = 0; | 89 virtual void CreateHistoricalTab(TabContentsWrapper* contents) = 0; |
| 90 | 90 |
| 91 // Runs any unload listeners associated with the specified TabContents before | 91 // Runs any unload listeners associated with the specified TabContentsWrapper |
| 92 // it is closed. If there are unload listeners that need to be run, this | 92 // before it is closed. If there are unload listeners that need to be run, |
| 93 // function returns true and the TabStripModel will wait before closing the | 93 // this function returns true and the TabStripModel will wait before closing |
| 94 // TabContents. If it returns false, there are no unload listeners and the | 94 // the TabContentsWrapper. If it returns false, there are no unload listeners |
| 95 // TabStripModel can close the TabContents immediately. | 95 // and the TabStripModel can close the TabContentsWrapper immediately. |
| 96 virtual bool RunUnloadListenerBeforeClosing(TabContentsWrapper* contents) = 0; | 96 virtual bool RunUnloadListenerBeforeClosing(TabContentsWrapper* contents) = 0; |
| 97 | 97 |
| 98 // Returns true if a tab can be restored. | 98 // Returns true if a tab can be restored. |
| 99 virtual bool CanRestoreTab() = 0; | 99 virtual bool CanRestoreTab() = 0; |
| 100 | 100 |
| 101 // Restores the last closed tab if CanRestoreTab would return true. | 101 // Restores the last closed tab if CanRestoreTab would return true. |
| 102 virtual void RestoreTab() = 0; | 102 virtual void RestoreTab() = 0; |
| 103 | 103 |
| 104 // Returns true if all contents in array of |indices| can be closed. | 104 // Returns true if all contents in array of |indices| can be closed. |
| 105 // Returns false if one or more of the contents can't be closed. | 105 // Returns false if one or more of the contents can't be closed. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 117 virtual bool CanCloseTab() const = 0; | 117 virtual bool CanCloseTab() const = 0; |
| 118 | 118 |
| 119 // Returns true if the tab strip can use large icons. | 119 // Returns true if the tab strip can use large icons. |
| 120 virtual bool LargeIconsPermitted() const = 0; | 120 virtual bool LargeIconsPermitted() const = 0; |
| 121 | 121 |
| 122 protected: | 122 protected: |
| 123 virtual ~TabStripModelDelegate() {} | 123 virtual ~TabStripModelDelegate() {} |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_DELEGATE_H_ | 126 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_DELEGATE_H_ |
| OLD | NEW |