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 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
15 #include "base/task.h" | 15 #include "base/task.h" |
16 #include "chrome/browser/command_updater.h" | 16 #include "chrome/browser/command_updater.h" |
17 #include "chrome/browser/pref_member.h" | 17 #include "chrome/browser/pref_member.h" |
18 #include "chrome/browser/sessions/session_id.h" | 18 #include "chrome/browser/sessions/session_id.h" |
19 #include "chrome/browser/sessions/tab_restore_service.h" | 19 #include "chrome/browser/sessions/tab_restore_service.h" |
20 #include "chrome/browser/shell_dialogs.h" | 20 #include "chrome/browser/shell_dialogs.h" |
21 #include "chrome/browser/tabs/tab_strip_model.h" | 21 #include "chrome/browser/tabs/tab_strip_model.h" |
22 #include "chrome/browser/tab_contents/page_navigator.h" | 22 #include "chrome/browser/tab_contents/page_navigator.h" |
23 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 23 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
24 #include "chrome/browser/toolbar_model.h" | 24 #include "chrome/browser/toolbar_model.h" |
25 #include "chrome/common/extensions/extension.h" | 25 #include "chrome/common/extensions/extension.h" |
26 #include "chrome/common/notification_registrar.h" | 26 #include "chrome/common/notification_registrar.h" |
| 27 #include "chrome/common/page_transition_types.h" |
27 #include "chrome/common/page_zoom.h" | 28 #include "chrome/common/page_zoom.h" |
28 #include "gfx/rect.h" | 29 #include "gfx/rect.h" |
29 | 30 |
30 class BrowserWindow; | 31 class BrowserWindow; |
31 class DebuggerWindow; | 32 class DebuggerWindow; |
32 class Extension; | 33 class Extension; |
33 class ExtensionShelfModel; | 34 class ExtensionShelfModel; |
34 class FindBarController; | 35 class FindBarController; |
35 class GoButton; | 36 class GoButton; |
36 class LocationBar; | 37 class LocationBar; |
(...skipping 564 matching lines...) Loading... |
601 virtual void ExecuteCommand(int id); | 602 virtual void ExecuteCommand(int id); |
602 | 603 |
603 // Helper function to run unload listeners on a TabContents. | 604 // Helper function to run unload listeners on a TabContents. |
604 static bool RunUnloadEventsHelper(TabContents* contents); | 605 static bool RunUnloadEventsHelper(TabContents* contents); |
605 | 606 |
606 // TabRestoreService::Observer /////////////////////////////////////////////// | 607 // TabRestoreService::Observer /////////////////////////////////////////////// |
607 virtual void TabRestoreServiceChanged(TabRestoreService* service); | 608 virtual void TabRestoreServiceChanged(TabRestoreService* service); |
608 virtual void TabRestoreServiceDestroyed(TabRestoreService* service); | 609 virtual void TabRestoreServiceDestroyed(TabRestoreService* service); |
609 | 610 |
610 private: | 611 private: |
| 612 FRIEND_TEST_ALL_PREFIXES(BrowserTest, PinnedTabDisposition); |
611 FRIEND_TEST_ALL_PREFIXES(BrowserTest, NoTabsInPopups); | 613 FRIEND_TEST_ALL_PREFIXES(BrowserTest, NoTabsInPopups); |
612 | 614 |
613 // Used to describe why a tab is being detached. This is used by | 615 // Used to describe why a tab is being detached. This is used by |
614 // TabDetachedAtImpl. | 616 // TabDetachedAtImpl. |
615 enum DetachType { | 617 enum DetachType { |
616 // Result of TabDetachedAt. | 618 // Result of TabDetachedAt. |
617 DETACH_TYPE_DETACH, | 619 DETACH_TYPE_DETACH, |
618 | 620 |
619 // Result of TabReplacedAt. | 621 // Result of TabReplacedAt. |
620 DETACH_TYPE_REPLACE, | 622 DETACH_TYPE_REPLACE, |
(...skipping 285 matching lines...) Loading... |
906 // policy of the tab strip model and notifies the window. | 908 // policy of the tab strip model and notifies the window. |
907 void UseVerticalTabsChanged(); | 909 void UseVerticalTabsChanged(); |
908 | 910 |
909 // Implementation of SupportsWindowFeature and CanSupportWindowFeature. If | 911 // Implementation of SupportsWindowFeature and CanSupportWindowFeature. If |
910 // |check_fullscreen| is true, the set of features reflect the actual state of | 912 // |check_fullscreen| is true, the set of features reflect the actual state of |
911 // the browser, otherwise the set of features reflect the possible state of | 913 // the browser, otherwise the set of features reflect the possible state of |
912 // the browser. | 914 // the browser. |
913 bool SupportsWindowFeatureImpl(WindowFeature feature, | 915 bool SupportsWindowFeatureImpl(WindowFeature feature, |
914 bool check_fullscreen) const; | 916 bool check_fullscreen) const; |
915 | 917 |
| 918 // Calculate a new window open disposition for a navigation. The return |
| 919 // value will usually be |original_disposition|, but for some pinned tab cases |
| 920 // we change it to NEW_FOREGROUND_TAB so that the pinned tab feels more |
| 921 // permanent. |
| 922 static WindowOpenDisposition AdjustWindowOpenDispositionForTab( |
| 923 bool is_pinned, |
| 924 const GURL& url, |
| 925 const GURL& referrer, |
| 926 PageTransition::Type transition, |
| 927 WindowOpenDisposition original_disposition); |
| 928 |
916 // Data members ///////////////////////////////////////////////////////////// | 929 // Data members ///////////////////////////////////////////////////////////// |
917 | 930 |
918 NotificationRegistrar registrar_; | 931 NotificationRegistrar registrar_; |
919 | 932 |
920 // This Browser's type. | 933 // This Browser's type. |
921 const Type type_; | 934 const Type type_; |
922 | 935 |
923 // This Browser's profile. | 936 // This Browser's profile. |
924 Profile* const profile_; | 937 Profile* const profile_; |
925 | 938 |
(...skipping 112 matching lines...) Loading... |
1038 mutable BooleanPrefMember use_vertical_tabs_; | 1051 mutable BooleanPrefMember use_vertical_tabs_; |
1039 | 1052 |
1040 // The profile's tab restore service. The service is owned by the profile, | 1053 // The profile's tab restore service. The service is owned by the profile, |
1041 // and we install ourselves as an observer. | 1054 // and we install ourselves as an observer. |
1042 TabRestoreService* tab_restore_service_; | 1055 TabRestoreService* tab_restore_service_; |
1043 | 1056 |
1044 DISALLOW_COPY_AND_ASSIGN(Browser); | 1057 DISALLOW_COPY_AND_ASSIGN(Browser); |
1045 }; | 1058 }; |
1046 | 1059 |
1047 #endif // CHROME_BROWSER_BROWSER_H_ | 1060 #endif // CHROME_BROWSER_BROWSER_H_ |
OLD | NEW |