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_BROWSER_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_H_ |
6 #define CHROME_BROWSER_BROWSER_H_ | 6 #define CHROME_BROWSER_BROWSER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 virtual void ExecuteCommand(int id); | 614 virtual void ExecuteCommand(int id); |
615 | 615 |
616 // Helper function to run unload listeners on a TabContents. | 616 // Helper function to run unload listeners on a TabContents. |
617 static bool RunUnloadEventsHelper(TabContents* contents); | 617 static bool RunUnloadEventsHelper(TabContents* contents); |
618 | 618 |
619 // TabRestoreService::Observer /////////////////////////////////////////////// | 619 // TabRestoreService::Observer /////////////////////////////////////////////// |
620 virtual void TabRestoreServiceChanged(TabRestoreService* service); | 620 virtual void TabRestoreServiceChanged(TabRestoreService* service); |
621 virtual void TabRestoreServiceDestroyed(TabRestoreService* service); | 621 virtual void TabRestoreServiceDestroyed(TabRestoreService* service); |
622 | 622 |
623 private: | 623 private: |
624 FRIEND_TEST_ALL_PREFIXES(BrowserTest, PinnedTabDisposition); | |
625 FRIEND_TEST_ALL_PREFIXES(BrowserTest, NoTabsInPopups); | 624 FRIEND_TEST_ALL_PREFIXES(BrowserTest, NoTabsInPopups); |
626 | 625 |
627 // Used to describe why a tab is being detached. This is used by | 626 // Used to describe why a tab is being detached. This is used by |
628 // TabDetachedAtImpl. | 627 // TabDetachedAtImpl. |
629 enum DetachType { | 628 enum DetachType { |
630 // Result of TabDetachedAt. | 629 // Result of TabDetachedAt. |
631 DETACH_TYPE_DETACH, | 630 DETACH_TYPE_DETACH, |
632 | 631 |
633 // Result of TabReplacedAt. | 632 // Result of TabReplacedAt. |
634 DETACH_TYPE_REPLACE, | 633 DETACH_TYPE_REPLACE, |
635 | 634 |
636 // Result of the tab strip not having any significant tabs. | 635 // Result of the tab strip not having any significant tabs. |
637 DETACH_TYPE_EMPTY | 636 DETACH_TYPE_EMPTY |
638 }; | 637 }; |
639 | 638 |
640 bool IsPinned(TabContents* source); | |
641 | |
642 // Overridden from TabStripModelDelegate: | 639 // Overridden from TabStripModelDelegate: |
643 virtual TabContents* AddBlankTab(bool foreground); | 640 virtual TabContents* AddBlankTab(bool foreground); |
644 virtual TabContents* AddBlankTabAt(int index, bool foreground); | 641 virtual TabContents* AddBlankTabAt(int index, bool foreground); |
645 virtual Browser* CreateNewStripWithContents(TabContents* detached_contents, | 642 virtual Browser* CreateNewStripWithContents(TabContents* detached_contents, |
646 const gfx::Rect& window_bounds, | 643 const gfx::Rect& window_bounds, |
647 const DockInfo& dock_info, | 644 const DockInfo& dock_info, |
648 bool maximize); | 645 bool maximize); |
649 virtual void ContinueDraggingDetachedTab(TabContents* contents, | 646 virtual void ContinueDraggingDetachedTab(TabContents* contents, |
650 const gfx::Rect& window_bounds, | 647 const gfx::Rect& window_bounds, |
651 const gfx::Rect& tab_bounds); | 648 const gfx::Rect& tab_bounds); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 | 940 |
944 // Determines if closing of browser can really be permitted after normal | 941 // Determines if closing of browser can really be permitted after normal |
945 // sequence of downloads and unload handlers have given the go-ahead to close. | 942 // sequence of downloads and unload handlers have given the go-ahead to close. |
946 // It is called from ShouldCloseWindow. It checks with | 943 // It is called from ShouldCloseWindow. It checks with |
947 // TabCloseableStateWatcher to confirm if browser can really be closed. | 944 // TabCloseableStateWatcher to confirm if browser can really be closed. |
948 // Appropriate action is taken by watcher as it sees fit. | 945 // Appropriate action is taken by watcher as it sees fit. |
949 // If watcher denies closing of browser, CancelWindowClose is called to | 946 // If watcher denies closing of browser, CancelWindowClose is called to |
950 // cancel closing of window. | 947 // cancel closing of window. |
951 bool IsClosingPermitted(); | 948 bool IsClosingPermitted(); |
952 | 949 |
953 // Calculate a new window open disposition for a navigation. The return | |
954 // value will usually be |original_disposition|, but for some pinned tab cases | |
955 // we change it to NEW_FOREGROUND_TAB so that the pinned tab feels more | |
956 // permanent. | |
957 static WindowOpenDisposition AdjustWindowOpenDispositionForTab( | |
958 bool is_pinned, | |
959 const GURL& url, | |
960 const GURL& referrer, | |
961 PageTransition::Type transition, | |
962 WindowOpenDisposition original_disposition); | |
963 | |
964 // Data members ///////////////////////////////////////////////////////////// | 950 // Data members ///////////////////////////////////////////////////////////// |
965 | 951 |
966 NotificationRegistrar registrar_; | 952 NotificationRegistrar registrar_; |
967 | 953 |
968 // This Browser's type. | 954 // This Browser's type. |
969 const Type type_; | 955 const Type type_; |
970 | 956 |
971 // This Browser's profile. | 957 // This Browser's profile. |
972 Profile* const profile_; | 958 Profile* const profile_; |
973 | 959 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 mutable BooleanPrefMember use_vertical_tabs_; | 1069 mutable BooleanPrefMember use_vertical_tabs_; |
1084 | 1070 |
1085 // The profile's tab restore service. The service is owned by the profile, | 1071 // The profile's tab restore service. The service is owned by the profile, |
1086 // and we install ourselves as an observer. | 1072 // and we install ourselves as an observer. |
1087 TabRestoreService* tab_restore_service_; | 1073 TabRestoreService* tab_restore_service_; |
1088 | 1074 |
1089 DISALLOW_COPY_AND_ASSIGN(Browser); | 1075 DISALLOW_COPY_AND_ASSIGN(Browser); |
1090 }; | 1076 }; |
1091 | 1077 |
1092 #endif // CHROME_BROWSER_BROWSER_H_ | 1078 #endif // CHROME_BROWSER_BROWSER_H_ |
OLD | NEW |