OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_BROWSER_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_H_ |
6 #define CHROME_BROWSER_UI_BROWSER_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" | 36 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" |
37 #include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h" | 37 #include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h" |
38 #include "chrome/browser/ui/shell_dialogs.h" | 38 #include "chrome/browser/ui/shell_dialogs.h" |
39 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" | 39 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" |
40 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 40 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
41 #include "chrome/common/content_settings_types.h" | 41 #include "chrome/common/content_settings_types.h" |
42 #include "chrome/common/extensions/extension_constants.h" | 42 #include "chrome/common/extensions/extension_constants.h" |
43 #include "content/browser/tab_contents/page_navigator.h" | 43 #include "content/browser/tab_contents/page_navigator.h" |
44 #include "content/browser/tab_contents/tab_contents_delegate.h" | 44 #include "content/browser/tab_contents/tab_contents_delegate.h" |
45 #include "content/common/notification_registrar.h" | 45 #include "content/common/notification_registrar.h" |
46 #include "content/common/page_transition_types.h" | |
47 #include "content/common/page_zoom.h" | 46 #include "content/common/page_zoom.h" |
| 47 #include "content/public/common/page_transition_types.h" |
48 #include "ui/base/ui_base_types.h" | 48 #include "ui/base/ui_base_types.h" |
49 #include "ui/gfx/rect.h" | 49 #include "ui/gfx/rect.h" |
50 | 50 |
51 class BrowserSyncedWindowDelegate; | 51 class BrowserSyncedWindowDelegate; |
52 class BrowserTabRestoreServiceDelegate; | 52 class BrowserTabRestoreServiceDelegate; |
53 class BrowserWindow; | 53 class BrowserWindow; |
54 class Extension; | 54 class Extension; |
55 class FindBarController; | 55 class FindBarController; |
56 class InstantController; | 56 class InstantController; |
57 class InstantUnloadHandler; | 57 class InstantUnloadHandler; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 // Returns the index to insert a tab at during session restore and startup. | 386 // Returns the index to insert a tab at during session restore and startup. |
387 // |relative_index| gives the index of the url into the number of tabs that | 387 // |relative_index| gives the index of the url into the number of tabs that |
388 // are going to be opened. For example, if three urls are passed in on the | 388 // are going to be opened. For example, if three urls are passed in on the |
389 // command line this is invoked three times with the values 0, 1 and 2. | 389 // command line this is invoked three times with the values 0, 1 and 2. |
390 int GetIndexForInsertionDuringRestore(int relative_index); | 390 int GetIndexForInsertionDuringRestore(int relative_index); |
391 | 391 |
392 // Adds a selected tab with the specified URL and transition, returns the | 392 // Adds a selected tab with the specified URL and transition, returns the |
393 // created TabContents. | 393 // created TabContents. |
394 TabContentsWrapper* AddSelectedTabWithURL( | 394 TabContentsWrapper* AddSelectedTabWithURL( |
395 const GURL& url, | 395 const GURL& url, |
396 PageTransition::Type transition); | 396 content::PageTransition transition); |
397 | 397 |
398 // Add a new tab, given a TabContents. A TabContents appropriate to | 398 // Add a new tab, given a TabContents. A TabContents appropriate to |
399 // display the last committed entry is created and returned. | 399 // display the last committed entry is created and returned. |
400 TabContents* AddTab(TabContentsWrapper* tab_contents, | 400 TabContents* AddTab(TabContentsWrapper* tab_contents, |
401 PageTransition::Type type); | 401 content::PageTransition type); |
402 | 402 |
403 // Add a tab with its session history restored from the SessionRestore | 403 // Add a tab with its session history restored from the SessionRestore |
404 // system. If select is true, the tab is selected. |tab_index| gives the index | 404 // system. If select is true, the tab is selected. |tab_index| gives the index |
405 // to insert the tab at. |selected_navigation| is the index of the | 405 // to insert the tab at. |selected_navigation| is the index of the |
406 // TabNavigation in |navigations| to select. If |extension_app_id| is | 406 // TabNavigation in |navigations| to select. If |extension_app_id| is |
407 // non-empty the tab is an app tab and |extension_app_id| is the id of the | 407 // non-empty the tab is an app tab and |extension_app_id| is the id of the |
408 // extension. If |pin| is true and |tab_index|/ is the last pinned tab, then | 408 // extension. If |pin| is true and |tab_index|/ is the last pinned tab, then |
409 // the newly created tab is pinned. If |from_last_session| is true, | 409 // the newly created tab is pinned. If |from_last_session| is true, |
410 // |navigations| are from the previous session. | 410 // |navigations| are from the previous session. |
411 TabContents* AddRestoredTab(const std::vector<TabNavigation>& navigations, | 411 TabContents* AddRestoredTab(const std::vector<TabNavigation>& navigations, |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 | 711 |
712 // Gets the last blocked command after calling SetBlockCommandExecution(true). | 712 // Gets the last blocked command after calling SetBlockCommandExecution(true). |
713 // Returns the command id or -1 if there is no command blocked. The | 713 // Returns the command id or -1 if there is no command blocked. The |
714 // disposition type of the command will be stored in |*disposition| if it's | 714 // disposition type of the command will be stored in |*disposition| if it's |
715 // not null. | 715 // not null. |
716 int GetLastBlockedCommand(WindowOpenDisposition* disposition); | 716 int GetLastBlockedCommand(WindowOpenDisposition* disposition); |
717 | 717 |
718 // Called by browser::Navigate() when a navigation has occurred in a tab in | 718 // Called by browser::Navigate() when a navigation has occurred in a tab in |
719 // this Browser. Updates the UI for the start of this navigation. | 719 // this Browser. Updates the UI for the start of this navigation. |
720 void UpdateUIForNavigationInTab(TabContentsWrapper* contents, | 720 void UpdateUIForNavigationInTab(TabContentsWrapper* contents, |
721 PageTransition::Type transition, | 721 content::PageTransition transition, |
722 bool user_initiated); | 722 bool user_initiated); |
723 | 723 |
724 // Called by browser::Navigate() to retrieve the home page if no URL is | 724 // Called by browser::Navigate() to retrieve the home page if no URL is |
725 // specified. | 725 // specified. |
726 GURL GetHomePage() const; | 726 GURL GetHomePage() const; |
727 | 727 |
728 // Shows the cookies collected in the tab contents wrapper. | 728 // Shows the cookies collected in the tab contents wrapper. |
729 void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper); | 729 void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper); |
730 | 730 |
731 // Interface implementations //////////////////////////////////////////////// | 731 // Interface implementations //////////////////////////////////////////////// |
732 | 732 |
733 // Overridden from PageNavigator: | 733 // Overridden from PageNavigator: |
734 // Deprecated. Please use the one-argument variant instead. | 734 // Deprecated. Please use the one-argument variant instead. |
735 // TODO(adriansc): Remove this method once refactoring changed all call sites. | 735 // TODO(adriansc): Remove this method once refactoring changed all call sites. |
736 virtual TabContents* OpenURL(const GURL& url, | 736 virtual TabContents* OpenURL(const GURL& url, |
737 const GURL& referrer, | 737 const GURL& referrer, |
738 WindowOpenDisposition disposition, | 738 WindowOpenDisposition disposition, |
739 PageTransition::Type transition) OVERRIDE; | 739 content::PageTransition transition) OVERRIDE; |
740 virtual TabContents* OpenURL(const OpenURLParams& params) OVERRIDE; | 740 virtual TabContents* OpenURL(const OpenURLParams& params) OVERRIDE; |
741 | 741 |
742 // Overridden from CommandUpdater::CommandUpdaterDelegate: | 742 // Overridden from CommandUpdater::CommandUpdaterDelegate: |
743 virtual void ExecuteCommand(int id); | 743 virtual void ExecuteCommand(int id); |
744 | 744 |
745 // Overridden from TabRestoreServiceObserver: | 745 // Overridden from TabRestoreServiceObserver: |
746 virtual void TabRestoreServiceChanged(TabRestoreService* service); | 746 virtual void TabRestoreServiceChanged(TabRestoreService* service); |
747 virtual void TabRestoreServiceDestroyed(TabRestoreService* service); | 747 virtual void TabRestoreServiceDestroyed(TabRestoreService* service); |
748 | 748 |
749 // Centralized method for creating a TabContents, configuring and installing | 749 // Centralized method for creating a TabContents, configuring and installing |
(...skipping 13 matching lines...) Expand all Loading... |
763 virtual TabContentsWrapper* AddBlankTab(bool foreground); | 763 virtual TabContentsWrapper* AddBlankTab(bool foreground); |
764 virtual TabContentsWrapper* AddBlankTabAt(int index, bool foreground); | 764 virtual TabContentsWrapper* AddBlankTabAt(int index, bool foreground); |
765 virtual Browser* CreateNewStripWithContents( | 765 virtual Browser* CreateNewStripWithContents( |
766 TabContentsWrapper* detached_contents, | 766 TabContentsWrapper* detached_contents, |
767 const gfx::Rect& window_bounds, | 767 const gfx::Rect& window_bounds, |
768 const DockInfo& dock_info, | 768 const DockInfo& dock_info, |
769 bool maximize); | 769 bool maximize); |
770 virtual int GetDragActions() const; | 770 virtual int GetDragActions() const; |
771 // Construct a TabContents for a given URL, profile and transition type. | 771 // Construct a TabContents for a given URL, profile and transition type. |
772 // If instance is not null, its process will be used to render the tab. | 772 // If instance is not null, its process will be used to render the tab. |
773 virtual TabContentsWrapper* CreateTabContentsForURL(const GURL& url, | 773 virtual TabContentsWrapper* CreateTabContentsForURL( |
774 const GURL& referrer, | 774 const GURL& url, |
775 Profile* profile, | 775 const GURL& referrer, |
776 PageTransition::Type transition, | 776 Profile* profile, |
777 bool defer_load, | 777 content::PageTransition transition, |
778 SiteInstance* instance) const; | 778 bool defer_load, |
| 779 SiteInstance* instance) const; |
779 virtual bool CanDuplicateContentsAt(int index); | 780 virtual bool CanDuplicateContentsAt(int index); |
780 virtual void DuplicateContentsAt(int index); | 781 virtual void DuplicateContentsAt(int index); |
781 virtual void CloseFrameAfterDragSession(); | 782 virtual void CloseFrameAfterDragSession(); |
782 virtual void CreateHistoricalTab(TabContentsWrapper* contents); | 783 virtual void CreateHistoricalTab(TabContentsWrapper* contents); |
783 virtual bool RunUnloadListenerBeforeClosing(TabContentsWrapper* contents); | 784 virtual bool RunUnloadListenerBeforeClosing(TabContentsWrapper* contents); |
784 virtual bool CanCloseContents(std::vector<int>* indices); | 785 virtual bool CanCloseContents(std::vector<int>* indices); |
785 virtual bool CanBookmarkAllTabs() const; | 786 virtual bool CanBookmarkAllTabs() const; |
786 virtual void BookmarkAllTabs(); | 787 virtual void BookmarkAllTabs(); |
787 virtual bool CanCloseTab() const; | 788 virtual bool CanCloseTab() const; |
788 virtual bool CanRestoreTab(); | 789 virtual bool CanRestoreTab(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 // Change is the result of a state change in the active tab. | 876 // Change is the result of a state change in the active tab. |
876 BOOKMARK_BAR_STATE_CHANGE_TAB_STATE, | 877 BOOKMARK_BAR_STATE_CHANGE_TAB_STATE, |
877 | 878 |
878 // Change is the result of window toggling in/out of fullscreen mode. | 879 // Change is the result of window toggling in/out of fullscreen mode. |
879 BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN, | 880 BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN, |
880 }; | 881 }; |
881 | 882 |
882 // Overridden from TabContentsDelegate: | 883 // Overridden from TabContentsDelegate: |
883 // Deprecated. Please use two-argument variant. | 884 // Deprecated. Please use two-argument variant. |
884 // TODO(adriansc): Remove this method once refactoring changed all call sites. | 885 // TODO(adriansc): Remove this method once refactoring changed all call sites. |
885 virtual TabContents* OpenURLFromTab(TabContents* source, | 886 virtual TabContents* OpenURLFromTab( |
886 const GURL& url, | 887 TabContents* source, |
887 const GURL& referrer, | 888 const GURL& url, |
888 WindowOpenDisposition disposition, | 889 const GURL& referrer, |
889 PageTransition::Type transition) OVERRIDE; | 890 WindowOpenDisposition disposition, |
| 891 content::PageTransition transition) OVERRIDE; |
890 virtual TabContents* OpenURLFromTab(TabContents* source, | 892 virtual TabContents* OpenURLFromTab(TabContents* source, |
891 const OpenURLParams& params) OVERRIDE; | 893 const OpenURLParams& params) OVERRIDE; |
892 virtual void NavigationStateChanged(const TabContents* source, | 894 virtual void NavigationStateChanged(const TabContents* source, |
893 unsigned changed_flags) OVERRIDE; | 895 unsigned changed_flags) OVERRIDE; |
894 virtual void AddNewContents(TabContents* source, | 896 virtual void AddNewContents(TabContents* source, |
895 TabContents* new_contents, | 897 TabContents* new_contents, |
896 WindowOpenDisposition disposition, | 898 WindowOpenDisposition disposition, |
897 const gfx::Rect& initial_pos, | 899 const gfx::Rect& initial_pos, |
898 bool user_gesture) OVERRIDE; | 900 bool user_gesture) OVERRIDE; |
899 virtual void ActivateContents(TabContents* contents) OVERRIDE; | 901 virtual void ActivateContents(TabContents* contents) OVERRIDE; |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 // True if the current tab entered fullscreen mode via webkitRequestFullScreen | 1404 // True if the current tab entered fullscreen mode via webkitRequestFullScreen |
1403 bool tab_caused_fullscreen_; | 1405 bool tab_caused_fullscreen_; |
1404 | 1406 |
1405 // True if the browser window has been shown at least once. | 1407 // True if the browser window has been shown at least once. |
1406 bool window_has_shown_; | 1408 bool window_has_shown_; |
1407 | 1409 |
1408 DISALLOW_COPY_AND_ASSIGN(Browser); | 1410 DISALLOW_COPY_AND_ASSIGN(Browser); |
1409 }; | 1411 }; |
1410 | 1412 |
1411 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1413 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
OLD | NEW |