| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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_DEFAULT_TAB_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_TABS_DEFAULT_TAB_HANDLER_H_ |
| 6 #define CHROME_BROWSER_TABS_DEFAULT_TAB_HANDLER_H_ | 6 #define CHROME_BROWSER_TABS_DEFAULT_TAB_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "chrome/browser/tabs/tab_handler.h" | 10 #include "chrome/browser/tabs/tab_handler.h" |
| 11 #include "chrome/browser/tabs/tab_strip_model_delegate.h" | 11 #include "chrome/browser/tabs/tab_strip_model_delegate.h" |
| 12 #include "chrome/browser/tabs/tab_strip_model_observer.h" | 12 #include "chrome/browser/tabs/tab_strip_model_observer.h" |
| 13 | 13 |
| 14 // A TabHandler implementation that interacts with the default TabStripModel. | 14 // A TabHandler implementation that interacts with the default TabStripModel. |
| 15 // The intent is that the TabStripModel API is contained at this level, and | 15 // The intent is that the TabStripModel API is contained at this level, and |
| 16 // never propagates beyond to the Browser. | 16 // never propagates beyond to the Browser. |
| 17 class DefaultTabHandler : public TabHandler, | 17 class DefaultTabHandler : public TabHandler, |
| 18 public TabStripModelDelegate, | 18 public TabStripModelDelegate, |
| 19 public TabStripModelObserver { | 19 public TabStripModelObserver { |
| 20 public: | 20 public: |
| 21 explicit DefaultTabHandler(TabHandlerDelegate* delegate); | 21 explicit DefaultTabHandler(TabHandlerDelegate* delegate); |
| 22 virtual ~DefaultTabHandler(); | 22 virtual ~DefaultTabHandler(); |
| 23 | 23 |
| 24 // Overridden from TabHandler: | 24 // Overridden from TabHandler: |
| 25 virtual TabStripModel* GetTabStripModel() const; | 25 virtual TabStripModel* GetTabStripModel() const; |
| 26 | 26 |
| 27 // Overridden from TabStripModelDelegate: | 27 // Overridden from TabStripModelDelegate: |
| 28 virtual TabContents* AddBlankTab(bool foreground); | 28 virtual TabContentsWrapper* AddBlankTab(bool foreground); |
| 29 virtual TabContents* AddBlankTabAt(int index, bool foreground); | 29 virtual TabContentsWrapper* AddBlankTabAt(int index, bool foreground); |
| 30 virtual Browser* CreateNewStripWithContents(TabContents* detached_contents, | 30 virtual Browser* CreateNewStripWithContents( |
| 31 const gfx::Rect& window_bounds, | 31 TabContentsWrapper* detached_contents, |
| 32 const DockInfo& dock_info, | 32 const gfx::Rect& window_bounds, |
| 33 bool maximize); | 33 const DockInfo& dock_info, |
| 34 virtual void ContinueDraggingDetachedTab(TabContents* contents, | 34 bool maximize); |
| 35 virtual void ContinueDraggingDetachedTab(TabContentsWrapper* contents, |
| 35 const gfx::Rect& window_bounds, | 36 const gfx::Rect& window_bounds, |
| 36 const gfx::Rect& tab_bounds); | 37 const gfx::Rect& tab_bounds); |
| 37 virtual int GetDragActions() const; | 38 virtual int GetDragActions() const; |
| 38 virtual TabContents* CreateTabContentsForURL(const GURL& url, | 39 virtual TabContentsWrapper* CreateTabContentsForURL( |
| 39 const GURL& referrer, | 40 const GURL& url, |
| 40 Profile* profile, | 41 const GURL& referrer, |
| 41 PageTransition::Type transition, | 42 Profile* profile, |
| 42 bool defer_load, | 43 PageTransition::Type transition, |
| 43 SiteInstance* instance) const; | 44 bool defer_load, |
| 45 SiteInstance* instance) const; |
| 44 virtual bool CanDuplicateContentsAt(int index); | 46 virtual bool CanDuplicateContentsAt(int index); |
| 45 virtual void DuplicateContentsAt(int index); | 47 virtual void DuplicateContentsAt(int index); |
| 46 virtual void CloseFrameAfterDragSession(); | 48 virtual void CloseFrameAfterDragSession(); |
| 47 virtual void CreateHistoricalTab(TabContents* contents); | 49 virtual void CreateHistoricalTab(TabContentsWrapper* contents); |
| 48 virtual bool RunUnloadListenerBeforeClosing(TabContents* contents); | 50 virtual bool RunUnloadListenerBeforeClosing(TabContentsWrapper* contents); |
| 49 virtual bool CanCloseContentsAt(int index); | 51 virtual bool CanCloseContentsAt(int index); |
| 50 virtual bool CanBookmarkAllTabs() const; | 52 virtual bool CanBookmarkAllTabs() const; |
| 51 virtual void BookmarkAllTabs(); | 53 virtual void BookmarkAllTabs(); |
| 52 virtual bool CanCloseTab() const; | 54 virtual bool CanCloseTab() const; |
| 53 virtual void ToggleUseVerticalTabs(); | 55 virtual void ToggleUseVerticalTabs(); |
| 54 virtual bool CanRestoreTab(); | 56 virtual bool CanRestoreTab(); |
| 55 virtual void RestoreTab(); | 57 virtual void RestoreTab(); |
| 56 virtual bool LargeIconsPermitted() const; | 58 virtual bool LargeIconsPermitted() const; |
| 57 virtual bool UseVerticalTabs() const; | 59 virtual bool UseVerticalTabs() const; |
| 58 | 60 |
| 59 // Overridden from TabStripModelObserver: | 61 // Overridden from TabStripModelObserver: |
| 60 virtual void TabInsertedAt(TabContents* contents, | 62 virtual void TabInsertedAt(TabContentsWrapper* contents, |
| 61 int index, | 63 int index, |
| 62 bool foreground); | 64 bool foreground); |
| 63 virtual void TabClosingAt(TabStripModel* tab_strip_model, | 65 virtual void TabClosingAt(TabStripModel* tab_strip_model, |
| 64 TabContents* contents, | 66 TabContentsWrapper* contents, |
| 65 int index); | 67 int index); |
| 66 virtual void TabDetachedAt(TabContents* contents, int index); | 68 virtual void TabDetachedAt(TabContentsWrapper* contents, int index); |
| 67 virtual void TabDeselectedAt(TabContents* contents, int index); | 69 virtual void TabDeselectedAt(TabContentsWrapper* contents, int index); |
| 68 virtual void TabSelectedAt(TabContents* old_contents, | 70 virtual void TabSelectedAt(TabContentsWrapper* old_contents, |
| 69 TabContents* new_contents, | 71 TabContentsWrapper* new_contents, |
| 70 int index, | 72 int index, |
| 71 bool user_gesture); | 73 bool user_gesture); |
| 72 virtual void TabMoved(TabContents* contents, | 74 virtual void TabMoved(TabContentsWrapper* contents, |
| 73 int from_index, | 75 int from_index, |
| 74 int to_index); | 76 int to_index); |
| 75 virtual void TabReplacedAt(TabContents* old_contents, | 77 virtual void TabReplacedAt(TabContentsWrapper* old_contents, |
| 76 TabContents* new_contents, | 78 TabContentsWrapper* new_contents, |
| 77 int index); | 79 int index); |
| 78 virtual void TabPinnedStateChanged(TabContents* contents, int index); | 80 virtual void TabPinnedStateChanged(TabContentsWrapper* contents, int index); |
| 79 virtual void TabStripEmpty(); | 81 virtual void TabStripEmpty(); |
| 80 | 82 |
| 81 private: | 83 private: |
| 82 TabHandlerDelegate* delegate_; | 84 TabHandlerDelegate* delegate_; |
| 83 | 85 |
| 84 scoped_ptr<TabStripModel> model_; | 86 scoped_ptr<TabStripModel> model_; |
| 85 | 87 |
| 86 DISALLOW_COPY_AND_ASSIGN(DefaultTabHandler); | 88 DISALLOW_COPY_AND_ASSIGN(DefaultTabHandler); |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 #endif // CHROME_BROWSER_TABS_DEFAULT_TAB_HANDLER_H_ | 91 #endif // CHROME_BROWSER_TABS_DEFAULT_TAB_HANDLER_H_ |
| 90 | 92 |
| OLD | NEW |